The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
{/*
* _____ _
*|_ _|_ _____ _ __ | |_ _ _
* | | \ \ /\ / / _ \ '_ \| __| | | | Auto-generated file
* | | \ V V / __/ | | | |_| |_| | DO NOT EDIT - changes will be overwritten
* |_| \_/\_/ \___|_| |_|\__|\__, | Generated by: npx nx generate:ui twenty-docs
* |___/
*
* This file is generated from the documentation data in packages/twenty-ui/generated.
* To update it, edit the component prop types or design tokens in twenty-ui and run:
* npx nx generate:ui twenty-docs
*/}
<ParamField body="checked" type="boolean">
Whether the switch is currently active.
To render an uncontrolled switch, use the `defaultChecked` prop instead.
</ParamField>
<ParamField body="className" type="string | ((state: SwitchRootState) => string | undefined)">
CSS class applied to the element, or a function that
returns a class based on the component's state.
</ParamField>
<ParamField body="defaultChecked" type="boolean" default="false">
Whether the switch is initially active.
To render a controlled switch, use the `checked` prop instead.
</ParamField>
<ParamField body="disabled" type="boolean" default="false">
Whether the component should ignore user interaction.
</ParamField>
<ParamField body="form" type="string">
Identifies the form that owns the hidden input.
Useful when the switch is rendered outside the form.
</ParamField>
<ParamField body="id" type="string">
The id of the hidden input element.
When `nativeButton` is `true`, the id is applied to the root element.
</ParamField>
<ParamField body="inputRef" type="Ref<HTMLInputElement>">
A ref to access the hidden `<input>` element.
</ParamField>
<ParamField body="name" type="string">
Identifies the field when a form is submitted.
</ParamField>
<ParamField body="nativeButton" type="boolean" default="false">
Whether the component renders a native `<button>` element when replacing it
via the `render` prop.
Set to `true` if the rendered element is a native button.
</ParamField>
<ParamField body="onCheckedChange" type="((checked: boolean, eventDetails: { reason: "none"; event: Event; cancel: () => void; allowPropagation: () => void; isCanceled: boolean; isPropagationAllowed: boolean; trigger: Element | undefined; }) => void)">
Event handler called when the switch is activated or deactivated.
</ParamField>
<ParamField body="readOnly" type="boolean" default="false">
Whether the user should be unable to activate or deactivate the switch.
</ParamField>
<ParamField body="render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, SwitchRootState>">
Allows you to replace the component's HTML element
with a different tag, or compose it with another component.
Accepts a `ReactElement` or a function that returns the element to render.
</ParamField>
<ParamField body="required" type="boolean" default="false">
Whether the user must activate the switch before submitting a form.
</ParamField>
<ParamField body="size" type=""md" | "sm"" default="md">
Visual size of the switch.
</ParamField>
<ParamField body="style" type="CSSProperties | ((state: SwitchRootState) => CSSProperties | undefined)">
Style applied to the element, or a function that
returns a style object based on the component's state.
</ParamField>
<ParamField body="uncheckedValue" type="string">
The value submitted with the form when the switch is off.
By default, unchecked switches do not submit any value, matching native checkbox behavior.
</ParamField>
<ParamField body="value" type="string">
The value submitted with the form when the switch is on.
By default, switch submits the "on" value, matching native checkbox behavior.
</ParamField>
### Switch.Root
<ParamField body="Root.checked" type="boolean">
Whether the switch is currently active.
To render an uncontrolled switch, use the `defaultChecked` prop instead.
</ParamField>
<ParamField body="Root.className" type="string | ((state: SwitchRootState) => string | undefined)">
CSS class applied to the element, or a function that
returns a class based on the component's state.
</ParamField>
<ParamField body="Root.defaultChecked" type="boolean" default="false">
Whether the switch is initially active.
To render a controlled switch, use the `checked` prop instead.
</ParamField>
<ParamField body="Root.disabled" type="boolean" default="false">
Whether the component should ignore user interaction.
</ParamField>
<ParamField body="Root.form" type="string">
Identifies the form that owns the hidden input.
Useful when the switch is rendered outside the form.
</ParamField>
<ParamField body="Root.id" type="string">
The id of the hidden input element.
When `nativeButton` is `true`, the id is applied to the root element.
</ParamField>
<ParamField body="Root.inputRef" type="Ref<HTMLInputElement>">
A ref to access the hidden `<input>` element.
</ParamField>
<ParamField body="Root.name" type="string">
Identifies the field when a form is submitted.
</ParamField>
<ParamField body="Root.nativeButton" type="boolean" default="false">
Whether the component renders a native `<button>` element when replacing it
via the `render` prop.
Set to `true` if the rendered element is a native button.
</ParamField>
<ParamField body="Root.onCheckedChange" type="((checked: boolean, eventDetails: { reason: "none"; event: Event; cancel: () => void; allowPropagation: () => void; isCanceled: boolean; isPropagationAllowed: boolean; trigger: Element | undefined; }) => void)">
Event handler called when the switch is activated or deactivated.
</ParamField>
<ParamField body="Root.readOnly" type="boolean" default="false">
Whether the user should be unable to activate or deactivate the switch.
</ParamField>
<ParamField body="Root.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, SwitchRootState>">
Allows you to replace the component's HTML element
with a different tag, or compose it with another component.
Accepts a `ReactElement` or a function that returns the element to render.
</ParamField>
<ParamField body="Root.required" type="boolean" default="false">
Whether the user must activate the switch before submitting a form.
</ParamField>
<ParamField body="Root.size" type=""md" | "sm"" default="md">
Visual size of the switch.
</ParamField>
<ParamField body="Root.style" type="CSSProperties | ((state: SwitchRootState) => CSSProperties | undefined)">
Style applied to the element, or a function that
returns a style object based on the component's state.
</ParamField>
<ParamField body="Root.uncheckedValue" type="string">
The value submitted with the form when the switch is off.
By default, unchecked switches do not submit any value, matching native checkbox behavior.
</ParamField>
<ParamField body="Root.value" type="string">
The value submitted with the form when the switch is on.
By default, switch submits the "on" value, matching native checkbox behavior.
</ParamField>
### Switch.Thumb
<ParamField body="Thumb.className" type="string | ((state: SwitchThumbState) => string | undefined)">
CSS class applied to the element, or a function that
returns a class based on the component's state.
</ParamField>
<ParamField body="Thumb.render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, SwitchThumbState>">
Allows you to replace the component's HTML element
with a different tag, or compose it with another component.
Accepts a `ReactElement` or a function that returns the element to render.
</ParamField>
<ParamField body="Thumb.style" type="CSSProperties | ((state: SwitchThumbState) => CSSProperties | undefined)">
Style applied to the element, or a function that
returns a style object based on the component's state.
</ParamField>