@madebywild/sanity-aspect-ratio-field
v1.0.1
Published
> [!IMPORTANT] > This package is primarily intended for internal use.
Readme
[!IMPORTANT] This package is primarily intended for internal use.
@madebywild/sanity-aspect-ratio-field
Sanity field type for selecting and validating aspect ratios.
Install
pnpm add @madebywild/sanity-aspect-ratio-fieldConfigure Plugin
import { defineConfig } from "sanity";
import { wildSanityAspectRatioFieldPlugin } from "@madebywild/sanity-aspect-ratio-field";
export default defineConfig({
plugins: [
wildSanityAspectRatioFieldPlugin({
// Plugin-level presets (used unless a field overrides them).
presets: [
"1:1",
{ label: "Portrait", value: "4:3" },
{ label: "Landscape", value: "16:9" },
],
}),
],
});Use in Schema
import { defineField } from "sanity";
defineField({
name: "ratio",
type: "wild.aspectRatio",
options: {
// Field-level override of plugin presets.
presets: ["", "3:2", { label: "Cinema", value: "21:9" }],
},
});