Toggle
Toggles are boolean form components used for easily enabling or disabling features.
Basic Example
Readonly State
You can set the toggle input to be readonly by using the readonly property.
Disabled State
You can set the toggle input to be disabled by using the disabled property.
Size Variants
You’re able to use the size property to control the size of your inputs, using one of the available sizes: sm, md, and lg. The default size is set to md.
Applying the size size property to an i-form-group will also set the chosen size to all of its i-toggle inputs.
Color Variants
You can use the color property to set a light or dark color for your toggle components.
Configuration
Props
Use props to modify the component’s design and behavior.
- Property
colorType'light' | 'dark'Default'light'Description The color variant of the checkbox - Property
disabledTypeBooleanDefaultfalseDescription The disabled state of the checkbox - Property
indeterminateTypeBooleanDefaultfalseDescription The indeterminate state of the checkbox - Property
valueTypeAnyDefaultfalseDescription Used to set the checkbox value when used inside a checkbox group - Property
modelValueTypeAnyDefaultfalseDescription Used to set the checkbox value when used by itself - Property
nameTypeStringDefaultuid()Description The unique identifier of the checkbox - Property
readonlyTypeBooleanDefaultfalseDescription The readonly state of the checkbox - Property
sizeType'sm' | 'md' | 'lg'Default'md'Description The size variant of the checkbox - Property
tabindexTypeNumber | StringDefault1Description The tabindex of the checkbox
Slots
Use slots to insert custom content into well-defined component locations.
- Property
defaultDescription Slot for default checkbox label
Events
Use events to react to something happening inside the component.
- Property
update:modelValueDescription Event emitted for setting the modelValue
CSS Variables
Read more about configuring Inkline’s Design System variables to update the look and feel of the component.
- Property
----backgroundValuecolor('light')Description The background of the toggle component - Property
----background--checkedValuecolor('primary')Description The background of the toggle component when checked - Property
----background--disabledValuecolor('light-40')Description The background of the toggle component when disabled - Property
----background--checked-disabledValuecolor('primary-25')Description The background of the toggle component when checked and disabled - Property
----border-colorValuecolor('light-55')Description The border-color of the toggle component - Property
----border-color--checkedValuecolor('primary-55')Description The border-color of the toggle component when checked - Property
----border-color--disabledValuecolor('light')Description The border-color of the toggle component when disabled - Property
----border-color--checked-disabledValuecolor('primary-30')Description The border-color of the toggle component when checked and disabled - Property
----border-styleValuevar(--border-style)Description The border style of the toggle component - Property
----border-top-widthValuevar(--border-top-width)Description The border top width of the toggle component - Property
----border-right-widthValuevar(--border-right-width)Description The border right width of the toggle component - Property
----border-bottom-widthValuevar(--border-bottom-width)Description The border bottom width of the toggle component - Property
----border-left-widthValuevar(--border-left-width)Description The border left width of the toggle component - Property
----border-widthValuevar(----border-top-width) var(----border-right-width) var(----border-bottom-width) var(----border-left-width)Description The border width of the toggle component - Property
----border-top-left-radiusValuevar(----height)Description The border top left radius of the toggle component - Property
----border-top-right-radiusValuevar(----height)Description The border top right radius of the toggle component - Property
----border-bottom-right-radiusValuevar(----height)Description The border bottom right radius of the toggle component - Property
----border-bottom-left-radiusValuevar(----height)Description The border bottom left radius of the toggle component - Property
----border-radiusValuevar(----border-top-left-radius) var(----border-top-right-radius) var(----border-bottom-right-radius) var(----border-bottom-left-radius)Description The border radius of the toggle component - Property
----box-shadow-offset-xValuevar(--box-shadow-offset-x)Description The box shadow horizontal offset of the toggle component - Property
----box-shadow-offset-yValuevar(--box-shadow-offset-y)Description The box shadow vertical offset of the toggle component - Property
----box-shadow-blur-radiusValuevar(--box-shadow-blur-radius)Description The box shadow blur radius of the toggle component - Property
----box-shadow-spread-radiusValuevar(--box-shadow-spread-radius)Description The box shadow spread radius of the toggle component - Property
----box-shadow-colorValuevar(--box-shadow-color)Description The box shadow spread radius of the toggle component - Property
----box-shadowValuevar(----box-shadow-offset-x) var(----box-shadow-offset-y) var(----box-shadow-blur-radius) var(----box-shadow-spread-radius) var(----box-shadow-color)Description The box shadow of the toggle component - Property
----margin-rightValuevar(--margin-right)Description The right margin of the toggle component - Property
----margin-topValuevar(--margin-right)Description The right margin of the toggle component - Property
----widthValue40pxDescription The width of the toggle component - Property
----heightValue20pxDescription The height of the toggle component - Property
----transition-durationValuevar(--transition-duration)Description The transition duration of the toggle component - Property
----indicator--backgroundValuecolor('white')Description The background of the toggle component indicator - Property
----indicator--background--checkedValuevar(----indicator--background)Description The background of the toggle component indicator when checked - Property
----indicator--background--disabledValuecolor('gray-05')Description The background of the toggle component indicator when disabled - Property
----indicator--background--checked-disabledValuecolor('gray-10')Description The background of the toggle component indicator when checked and disabled - Property
----indicator--border-top-left-radiusValue50%Description The border top left radius of the toggle component indicator - Property
----indicator--border-top-right-radiusValue50%Description The border top right radius of the toggle component indicator - Property
----indicator--border-bottom-right-radiusValue50%Description The border bottom right radius of the toggle component indicator - Property
----indicator--border-bottom-left-radiusValue50%Description The border bottom left radius of the toggle component indicator - Property
----indicator--border-radiusValuevar(----indicator--border-top-left-radius) var(----indicator--border-top-right-radius) var(----indicator--border-bottom-right-radius) var(----indicator--border-bottom-left-radius)Description The border radius of the toggle component indicator - Property
----indicator--widthValue16pxDescription The width of the toggle component indicator - Property
----indicator--heightValue16pxDescription The height of the toggle component indicator - Property
----label--colorValuecontrast-color($color-light)Description The color of the toggle component label - Property
----label--color--disabledValuecolor('light-70')Description The color of the toggle component label when disabled - Property
----label--font-sizeValuefont-size()Description The font size of the toggle component label