Skip to content

components/IconToggle

import { … } from 'zidane-ui'ui/src/components/IconToggle.tsx

sizes xs, sm, md, lg
active, danger, disabled
node icon, badge, render as link
IconToggle in a segment

Components#

IconToggleComponent#

Icon control for the panel toolbars, meant to sit in a .zg-segment group (pressed = the raised chip). label doubles as the accessible name and the tooltip (portalled: these sit in clipped rows). Keep it to a word or two.

TypeScript
function IconToggle(props: IconToggleProps): Element
Parameters
NameTypeDescription
propsIconToggleProps

Component props.

Element
IconToggle props
NameTypeDefaultDescription
activeboolean

Whether the toggle is pressed. Shows the raised chip and sets aria-pressed.

badge?string

Count next to the icon (changed-files toggle), in the meta voice.

className?string

Extra classes on the root element.

iconstring

Icon class for the glyph, such as i-ph-sidebar-simple.

labelstring

Accessible name and tooltip text. Keep it to a word or two.

onClick() => void

Called when the toggle is clicked.

size?'xs' | 'sm''sm'

Button height: xs is 20px, sm is 24px.

style?CSSProperties

Inline styles on the root element, merged after the component's own.

ui/src/components/IconToggle.tsx:37

Interfaces#

IconTogglePropsInterface#

Props for IconToggle.

TypeScript
interface IconToggleProps
IconToggleProps properties
NameTypeDefaultDescription
activeboolean

Whether the toggle is pressed. Shows the raised chip and sets aria-pressed.

badge?string

Count next to the icon (changed-files toggle), in the meta voice.

className?string

Extra classes on the root element.

iconstring

Icon class for the glyph, such as i-ph-sidebar-simple.

labelstring

Accessible name and tooltip text. Keep it to a word or two.

onClick() => void

Called when the toggle is clicked.

size?'xs' | 'sm''sm'

Button height: xs is 20px, sm is 24px.

style?CSSProperties

Inline styles on the root element, merged after the component's own.

ui/src/components/IconToggle.tsx:7