How to Use
Guide on how to use Schema UI components in your project
Using Schema UI Components
Follow these steps to integrate Schema UI components into your project:
1. Copy the Component
Copy the desired component from the Schema UI library and paste it into your project's /components/ui
folder.
2. Copy the Schema
Copy the corresponding schema and paste it into the /sanity/schemas/
folder in your project.
3. Copy the Query
Copy the related query and paste it into the /sanity/queries/
folder in your project.
4. Import the Schema to the main schema file /sanity/schema.ts
and add it to the schema
types array, for example:
5. Add schema type into the blocks array of the page
document schema in /sanity/schemas/documents/page.ts
:
6. Import the Query to the main page query file /sanity/queries/page.ts
and add it to the blocks
array, for example:
7. Import the Component to Blocks /components/blocks
and add it to the componentMap
, for example:
8. Skip this step if you're using our latest Next.js Sanity Starter.
If you're not using our Next.js Sanity Starter:
- add shared objects listed above in the step #4 under
shared objects
to your project; - add
section-container.tsx
to/components/ui
folder;
- safelist classes used for background colors and grid columns in
tailwind.config.js
: