Documentation Index
Fetch the complete documentation index at: https://mintlify.com/rijvi-mahmud/shaddy/llms.txt
Use this file to discover all available pages before exploring further.
SwitchField integrates shadcn/ui’s Switch component with ShaddyForm’s form context, binding a boolean form value to a toggle control. It supports flexible layout options — vertical or horizontal arrangement, configurable gap, and the ability to reverse the label/switch order — making it easy to match a variety of UI patterns without extra wrapper markup.
Installation
Install all ShaddyForm fields at once with theshaddy-form registry item:
Usage
Props
The field name. Must match a key in your Zod schema passed to
ShaddyForm.Label text rendered next to (or above, when
column is true) the switch. Omit to render the switch without a visible label.When
true, appends a red asterisk to the label as a visual indicator.Disables the underlying
Switch component when true.When
true, arranges the switch and label in a vertical column (flex-col) instead of the default horizontal row.When
true, pushes the switch and label to opposite ends of their container with justify-between. Useful for settings-list layouts.When
true, renders the label before the switch (label on the left, switch on the right). By default the switch appears first.The Tailwind gap class applied between the switch and its label.
Additional CSS classes applied to the outermost
FormItem wrapper.Notes
SwitchFieldmust be rendered inside a<ShaddyForm>— it readscontrolfromuseFormContextinternally.- The bound value is a
boolean. Initialise your schema field withz.boolean()and set a matching booleaninitialValuesentry. - Validation messages are rendered via
<FormMessage>and are clamped to one line to keep the layout compact.