Skip to content

components/Form

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

FormSection: rows
4 settings
Transcript density
Font size
14px
FormSection: cards
Office server
wss://zidane.example.com
A server with a long name that has to truncate somewhere sensible
packages/server/src/handlers/very-long-folder-name/another-nested-directory/session-title-generator.ts
Controls
mutedtextaccentsuccesswarndangerinfo
Notes
Installing…
Installed 3 skills.

Components#

CheckboxComponent#

The checkbox glyph for multi-select lists; the row around it is the control.

TypeScript
function Checkbox(props: CheckboxProps): Element
Parameters
NameTypeDescription
propsCheckboxProps

Component props.

Element
Checkbox props
NameTypeDescription
checkedboolean

Whether the box is ticked.

className?string

Extra classes on the root element.

style?CSSProperties

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

ui/src/components/Form.tsx:300

ErrorNoteComponent#

A failure worth reading: a soft danger wash, no border.

TypeScript
function ErrorNote(props: ErrorNoteProps): Element
Parameters
NameTypeDescription
propsErrorNoteProps

Component props.

Element
ErrorNote props
NameTypeDescription
childrenReactNode

The error message.

className?string

Extra classes on the root element.

style?CSSProperties

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

ui/src/components/Form.tsx:63

FormCardComponent#

An entity card lifted off its section tray (server, provider, environment).

TypeScript
function FormCard(props: FormCardProps): Element
Parameters
NameTypeDescription
propsFormCardProps

Component props.

Element
FormCard props
NameTypeDescription
childrenReactNode

The card's content.

className?string

Extra classes on the card.

data-testid?string

Test id for the card element.

style?CSSProperties

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

ui/src/components/Form.tsx:179

FormSectionComponent#

A labelled group. rows (default) hosts flat rows; cards spaces raised FormCards apart on the same tray.

TypeScript
function FormSection(props: FormSectionProps): Element
Parameters
NameTypeDescription
propsFormSectionProps

Component props.

Element
FormSection props
NameTypeDefaultDescription
childrenReactNode

The rows or cards.

className?string

Extra classes on the section.

layout?'rows' | 'cards''rows'

rows hosts flat rows; cards spaces raised FormCards apart.

style?CSSProperties

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

title?ReactNode

Label above the section. The label line is omitted when neither title nor trailing is set.

trailing?ReactNode

Right side of the label line: a count, a small action.

ui/src/components/Form.tsx:142

HostRowComponent#

A row whose one control sits among other buttons (a picker with Test and clear, a select, a switch beside a note): it washes on hover like a row button, and a click anywhere on it but on a button or a field works the control, the element marked data-row-control (or the button, select or input inside it; a select opens its list). Keyboard users reach the control itself.

TypeScript
function HostRow(props: HostRowProps): Element
Parameters
NameTypeDescription
propsHostRowProps

The row's div attributes, children and disabled.

Element
HostRow props
NameTypeDefaultDescription
childrenReactNode

The row's content, the control marked data-row-control among it.

disabled?booleanfalse

The control can't be used now: no wash, no forwarding.

ui/src/components/Form.tsx:424

MetaChipComponent#

A status or value chip set into its surface: track tone, meta voice.

TypeScript
function MetaChip(props: MetaChipProps): Element
Parameters
NameTypeDescription
propsMetaChipProps

Component props.

Element
MetaChip props
NameTypeDefaultDescription
childrenReactNode

The chip's content.

className?string

Extra classes on the chip.

style?CSSProperties

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

title?string

Native tooltip.

tone?'danger' | 'muted' | 'text' | 'accent' | 'success' | 'warn' | 'info''muted'

Text colour of the chip.

ui/src/components/Form.tsx:244

A row that navigates somewhere (another modal, a sub-surface).

TypeScript
function NavRow(props: NavRowProps): Element
Parameters
NameTypeDescription
propsNavRowProps

Component props.

Element
NavRow props
NameTypeDescription
action{ description: string; icon: string; label: string; onSelect: () => void }

The row: its label, description and icon class, and onSelect, called when the row is clicked.

className?string

Extra classes on the root element.

style?CSSProperties

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

ui/src/components/Form.tsx:388

OpLineComponent#

One-line feedback for a lifecycle op (install / update / remove).

TypeScript
function OpLine(props: OpLineProps): Element
Parameters
NameTypeDescription
propsOpLineProps

Component props.

Element
OpLine props
NameTypeDescription
childrenReactNode

The feedback text.

className?string

Extra classes on the root element.

kind'error' | 'busy' | 'notice'

Tone of the line: busy and notice are muted (a result worth a quiet line, never a celebration: a success that shows elsewhere needs no line at all), and error is danger-coloured and announced as an alert.

style?CSSProperties

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

ui/src/components/Form.tsx:98

RowTextComponent#

Label over an optional muted description, the left half of every row.

TypeScript
function RowText(props: RowTextProps): Element
Parameters
NameTypeDescription
propsRowTextProps

Component props.

Element
RowText props
NameTypeDefaultDescription
className?string

Extra classes on the root element.

description?ReactNode

Muted text under the label.

labelReactNode

The row's main text.

style?CSSProperties

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

truncate?booleantrue

Cut the description to one line with an ellipsis. When off, it wraps.

ui/src/components/Form.tsx:209

SegmentedRowComponent#

Label + description on the left, a Segmented picker on the right.

TypeScript
function SegmentedRow<T extends string>(props: SegmentedRowProps<T>): Element
Type parameters
NameTypeDescription
Textends string
Parameters
NameTypeDescription
propsSegmentedRowProps<T>

Component props.

Element
SegmentedRow props
NameTypeDescription
className?string

Extra classes on the root element.

description?string

Muted text under the label. It wraps.

labelstring

The row's main text. It also names the choice group.

onChange(v: T) => void

Called with the new value when an option is picked.

options{ disabled?: boolean; icon?: string; label: string; title?: string; value: T }[]

The choices, as SegmentedOptions with a string label.

style?CSSProperties

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

valueT

The value of the selected option.

ui/src/components/Form.tsx:515

SliderRowComponent#

Labelled range input with a value readout and a reset.

TypeScript
function SliderRow(props: SliderRowProps): Element
Parameters
NameTypeDescription
propsSliderRowProps

Component props.

Element
SliderRow props
NameTypeDescription
className?string

Extra classes on the root element.

description?string

Muted text under the label. It wraps.

format(v: number) => string

Formats the value for the readout beside the slider.

labelstring

The row's main text. It also names the slider.

maxnumber

Highest value.

minnumber

Lowest value.

onChange(v: number) => void

Called with the new value while the slider moves.

onReset?() => void

Called when the slider is double-clicked, to restore the default value.

stepnumber

Increment between values.

style?CSSProperties

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

valuenumber

Current value.

ui/src/components/Form.tsx:563

SwitchComponent#

The settings-row switch glyph (SwitchGlyph md); the row around it is the control.

TypeScript
function Switch(props: SwitchProps): Element
Parameters
NameTypeDescription
propsSwitchProps

Component props.

Element
Switch props
NameTypeDescription
className?string

Extra classes on the root element.

onboolean

Whether the switch is on.

style?CSSProperties

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

ui/src/components/Form.tsx:281

SwitchRowComponent#

Plain on/off row for store-backed booleans (not the vendored settings table).

TypeScript
function SwitchRow(props: SwitchRowProps): Element
Parameters
NameTypeDescription
propsSwitchRowProps

Component props.

Element
SwitchRow props
NameTypeDescription
className?string

Extra classes on the root element.

description?string

Muted text under the label. It wraps.

labelstring

The row's main text.

onboolean

Whether the option is on.

onToggle() => void

Called when the row is clicked.

style?CSSProperties

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

ui/src/components/Form.tsx:476

ToggleSwitchComponent#

A standalone switch control, for rows that host other buttons too.

TypeScript
function ToggleSwitch(props: ToggleSwitchProps): Element
Parameters
NameTypeDescription
propsToggleSwitchProps

Component props.

Element
ToggleSwitch props
NameTypeDefaultDescription
className?string

Extra classes on the root element.

disabled?booleanfalse

Grey the switch out and ignore clicks.

labelstring

Accessible name of the switch. It has no visible text.

onboolean

Whether the switch is on.

onChange(on: boolean) => void

Called with the new state when the switch is clicked.

style?CSSProperties

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

title?string

Native tooltip.

ui/src/components/Form.tsx:347

Constants#

FIELD_LABEL_CLASSConstant#

Label above a form field.

TypeScript
const FIELD_LABEL_CLASS = 'block text-xs text-[var(--zg-text-muted)] mb-1'

ui/src/components/Form.tsx:43

FORM_CARD_CLASSConstant#

An inline add / install form: a raised card above the list it feeds.

TypeScript
const FORM_CARD_CLASS = 'zg-raised border rounded-zg-lg p-4 space-y-3'

ui/src/components/Form.tsx:46

INPUT_CLASSConstant#

Single-line text input: a well set into its surface.

TypeScript
const INPUT_CLASS: 'zg-well w-full h-8 px-2.5 text-zg-ui placeholder:text-[var(--zg-text-subtle)] disabled:opacity-zg-disabled'

ui/src/components/Form.tsx:35

ROW_BUTTON_CLASSConstant#

A whole-row button inside a section tray: flat, washed on hover.

TypeScript
const ROW_BUTTON_CLASS = ...

ui/src/components/Form.tsx:20

ROW_CLASSConstant#

A static row whose control (segment, slider, input) takes the input.

TypeScript
const ROW_CLASS = 'flex items-center gap-3 px-3 py-2'

ui/src/components/Form.tsx:23

ROW_HOST_CLASSConstant#

A HostRow's surface: a row button's wash, giving with the control inside (zg-press-host).

TypeScript
const ROW_HOST_CLASS = ...

ui/src/components/Form.tsx:26

ROW_TRIGGER_CLASSConstant#

The control of a HostRow that takes the row's width: a picker's trigger, holding the label and the value.

TypeScript
const ROW_TRIGGER_CLASS = ...

ui/src/components/Form.tsx:29

TEXTAREA_CLASSConstant#

Multi-line / code input.

TypeScript
const TEXTAREA_CLASS: 'zg-well w-full px-2.5 py-2 text-zg-label font-mono leading-relaxed placeholder:text-[var(--zg-text-subtle)] resize-y'

ui/src/components/Form.tsx:39

Interfaces#

CheckboxPropsInterface#

Props for Checkbox.

TypeScript
interface CheckboxProps
CheckboxProps properties
NameTypeDescription
checkedboolean

Whether the box is ticked.

className?string

Extra classes on the root element.

style?CSSProperties

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

ui/src/components/Form.tsx:286

ErrorNotePropsInterface#

Props for ErrorNote.

TypeScript
interface ErrorNoteProps
ErrorNoteProps properties
NameTypeDescription
childrenReactNode

The error message.

className?string

Extra classes on the root element.

style?CSSProperties

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

ui/src/components/Form.tsx:49

FormCardPropsInterface#

Props for FormCard.

TypeScript
interface FormCardProps
FormCardProps properties
NameTypeDescription
childrenReactNode

The card's content.

className?string

Extra classes on the card.

data-testid?string

Test id for the card element.

style?CSSProperties

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

ui/src/components/Form.tsx:163

FormSectionPropsInterface#

Props for FormSection.

TypeScript
interface FormSectionProps
FormSectionProps properties
NameTypeDefaultDescription
childrenReactNode

The rows or cards.

className?string

Extra classes on the section.

layout?'rows' | 'cards''rows'

rows hosts flat rows; cards spaces raised FormCards apart.

style?CSSProperties

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

title?ReactNode

Label above the section. The label line is omitted when neither title nor trailing is set.

trailing?ReactNode

Right side of the label line: a count, a small action.

ui/src/components/Form.tsx:116

HostRowPropsInterface#

Props for HostRow: the row's div attributes, children and disabled.

TypeScript
interface HostRowProps extends HTMLAttributes<HTMLDivElement>
HostRowProps properties
NameTypeDefaultDescription
childrenReactNode

The row's content, the control marked data-row-control among it.

disabled?booleanfalse

The control can't be used now: no wash, no forwarding.

ui/src/components/Form.tsx:404

MetaChipPropsInterface#

Props for MetaChip.

TypeScript
interface MetaChipProps
MetaChipProps properties
NameTypeDefaultDescription
childrenReactNode

The chip's content.

className?string

Extra classes on the chip.

style?CSSProperties

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

title?string

Native tooltip.

tone?'danger' | 'muted' | 'text' | 'accent' | 'success' | 'warn' | 'info''muted'

Text colour of the chip.

ui/src/components/Form.tsx:223

Props for NavRow.

TypeScript
interface NavRowProps
NavRowProps properties
NameTypeDescription
action{ description: string; icon: string; label: string; onSelect: () => void }

The row: its label, description and icon class, and onSelect, called when the row is clicked.

className?string

Extra classes on the root element.

style?CSSProperties

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

ui/src/components/Form.tsx:371

OpLinePropsInterface#

Props for OpLine.

TypeScript
interface OpLineProps
OpLineProps properties
NameTypeDescription
childrenReactNode

The feedback text.

className?string

Extra classes on the root element.

kind'error' | 'busy' | 'notice'

Tone of the line: busy and notice are muted (a result worth a quiet line, never a celebration: a success that shows elsewhere needs no line at all), and error is danger-coloured and announced as an alert.

style?CSSProperties

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

ui/src/components/Form.tsx:78

RowTextPropsInterface#

Props for RowText.

TypeScript
interface RowTextProps
RowTextProps properties
NameTypeDefaultDescription
className?string

Extra classes on the root element.

description?ReactNode

Muted text under the label.

labelReactNode

The row's main text.

style?CSSProperties

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

truncate?booleantrue

Cut the description to one line with an ellipsis. When off, it wraps.

ui/src/components/Form.tsx:188

SegmentedRowPropsInterface#

Props for SegmentedRow.

TypeScript
interface SegmentedRowProps<T extends string>
SegmentedRowProps type parameters
NameTypeDescription
Textends string
SegmentedRowProps properties
NameTypeDescription
className?string

Extra classes on the root element.

description?string

Muted text under the label. It wraps.

labelstring

The row's main text. It also names the choice group.

onChange(v: T) => void

Called with the new value when an option is picked.

options{ disabled?: boolean; icon?: string; label: string; title?: string; value: T }[]

The choices, as SegmentedOptions with a string label.

style?CSSProperties

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

valueT

The value of the selected option.

ui/src/components/Form.tsx:493

SliderRowPropsInterface#

Props for SliderRow.

TypeScript
interface SliderRowProps
SliderRowProps properties
NameTypeDescription
className?string

Extra classes on the root element.

description?string

Muted text under the label. It wraps.

format(v: number) => string

Formats the value for the readout beside the slider.

labelstring

The row's main text. It also names the slider.

maxnumber

Highest value.

minnumber

Lowest value.

onChange(v: number) => void

Called with the new value while the slider moves.

onReset?() => void

Called when the slider is double-clicked, to restore the default value.

stepnumber

Increment between values.

style?CSSProperties

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

valuenumber

Current value.

ui/src/components/Form.tsx:533

SwitchPropsInterface#

Props for Switch.

TypeScript
interface SwitchProps
SwitchProps properties
NameTypeDescription
className?string

Extra classes on the root element.

onboolean

Whether the switch is on.

style?CSSProperties

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

ui/src/components/Form.tsx:267

SwitchRowPropsInterface#

Props for SwitchRow.

TypeScript
interface SwitchRowProps
SwitchRowProps properties
NameTypeDescription
className?string

Extra classes on the root element.

description?string

Muted text under the label. It wraps.

labelstring

The row's main text.

onboolean

Whether the option is on.

onToggle() => void

Called when the row is clicked.

style?CSSProperties

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

ui/src/components/Form.tsx:456

ToggleSwitchPropsInterface#

Props for ToggleSwitch.

TypeScript
interface ToggleSwitchProps
ToggleSwitchProps properties
NameTypeDefaultDescription
className?string

Extra classes on the root element.

disabled?booleanfalse

Grey the switch out and ignore clicks.

labelstring

Accessible name of the switch. It has no visible text.

onboolean

Whether the switch is on.

onChange(on: boolean) => void

Called with the new state when the switch is clicked.

style?CSSProperties

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

title?string

Native tooltip.

ui/src/components/Form.tsx:322