Skip to Content
Referencesanity-plugin-fusionConfiguration

Configuration

import { defineConfig } from "sanity"; import { fusion } from "@codedazur/sanity-plugin-fusion"; export default defineConfig({ //... plugins: [ // ... fusion(), ], });

Routes

fusion({ routes: ["myPage"], });

Themes

fusion({ themes: [ { value: "light", title: "Light" }, { value: "dark", title: "Dark" }, ], });

Aspect Ratios

fusion({ aspectRatios: ["16:9", "4:3"], });

Sections

import { defineConfig } from "sanity"; import { mySectionSchema } from "./schemas//mySectionSchema"; export default defineConfig({ fusion({ sections: [mySectionSchema], }), });

Adding a Section

fusion({ sections(schemas) { return [...schemas, mySectionSchema].sort((a, b) => a.name.localeCompare(b.name), ); }, });

Removing a Section

fusion({ sections(sections) { return sections.filter( (schema) => schema.name !== SectionType.ImageSection, ); }, });

Fields

Mutating an Existing Field

export default defineConfig({ fusion({ fields: (schemas) => schemas.map((schema) => { if (schema.name === FieldType.Theme && isStringDefinition(schema)) { schema.hidden = false; if (schema.options?.list?.length === 0) { schema.readOnly = true; } schema.options?.list?.unshift({ title: "Inherit", value: undefined, }); } return schema; }), });
import { BaseSchemaDefinition, StringDefinition } from "sanity"; function isStringDefinition( field: BaseSchemaDefinition, ): field is StringDefinition { return "type" in field && field.type === "string"; }

Reference

OptionTypeRequiredDescription
routesstring[]YesAn array of strings, where each string is the name of a Sanity document type in your schema that represents a navigable page or route (e.g., ["page", "article"]).
sectionsBaseSchemaDefinition[] | ((defaultSections: BaseSchemaDefinition[]) => BaseSchemaDefinition[])NoAllows customization of the page section schemas.
fieldsBaseSchemaDefinition[] | ((defaultFields: BaseSchemaDefinition[]) => BaseSchemaDefinition[])NoAllows customization of the field-level schemas.
themesTitledListValue<string>[]NoAn array of objects { title: string, value: string } defining custom themes for selection in the Studio. The value should be the CSS class name of a theme (preferably an imported Vanilla Extract theme class name if your themes are managed this way).
aspectRatiosstring[]NoAn array of strings defining allowed aspect ratios using colons (e.g., ["16:9", "4:3"]). Defaults to a list from fusion-ui.
Last updated on