Skip to content

Switch

A native checkbox input, styled as a switch with pure CSS.


---
import { Switch } from 'fulldev-ui'
---
<Switch />

Props

size

Type: size?: 'sm' | 'md' | 'lg'

Sets the size for this component and all its children.

---
import { Switch } from 'fulldev-ui'
---
<Switch size="sm" />
<Switch size="md" />
<Switch size="lg" />

density

Type: density?: 'base' | 'compact' | string

Changes the underlying values used by the size prop, for this component and all its children.

For example, we set compact on a card and can now size this and all children automatically based on the size on the wrapping block/section.

Choose a predefined density, or a custom value defined like explained in the theming guide.

---
import { Switch } from 'fulldev-ui'
---
<Switch density="compact" size="sm" />
<Switch density="compact" size="md" />
<Switch density="compact" size="lg" />

theme

Type: theme?: 'light' | 'dark' | string

Changes the colors for this component and all its children.

Choose a predefined theme, or a custom value defined like explained in the theming guide.

as & HTML Attributes

Type: as?: HTMLTag = 'a'

Used to determine which HTML tag is used to render the component.

Based on the value, all HTML attributes of this tag are accepted as props too.

For a detailed explanation see Polymorphic props in the Astro documentation.