Skip to content
Cook
Documentation Browse

Design

Buttons and forms

Button, Input, Checkbox, Switch, Segmented Tabs and the Composer: what each is for, how it looks, and its properties.

Button

One primary button per view. Neutral for everything else. Icons sit at 16px with 6px of gap.

Variants

Get startedBook a callCancelDelete routine
<Button.Root variant="primary" mode="filled">
  Get started
  <Button.Icon as={ArrowRightIcon} />
</Button.Root>
<Button.Root variant="neutral" mode="stroke">Book a call</Button.Root>
<Button.Root variant="error" mode="filled">Delete routine</Button.Root>

Sizes

Heights 28, 32, 36 and 40px.

Extra smallSmallMediumLarge
<Button.Root size="xxsmall">Extra small</Button.Root>
<Button.Root size="small">Small</Button.Root>
<Button.Root size="medium">Medium</Button.Root>

With icons and states

A pending button keeps its width and swaps the icon for the hop while the work runs. An icon-only button is a compact button, and gets a tooltip.

Approve changes (3)Clone funnelPublish funnelDisabled
<PendingButton onClick={publish} icon={CustomDomainIcon}>Publish funnel</PendingButton>
<CompactButton.Root><CompactButton.Icon as={CopyIcon} /></CompactButton.Root>

Properties

PropTypeDefaultDescription
variant"primary" | "neutral" | "error""primary"Colour family.
mode"filled" | "stroke" | "lighter" | "ghost""filled"Surface weight.
size"xxsmall" | "xsmall" | "small" | "medium""medium"Height 28 / 32 / 36 / 40px.
disabledbooleanfalseDisables the button.
asChildbooleanfalseRender as the child element, e.g. a Link.

Input

Inputs have a label above, a hint below, and an optional icon or affix inside. An error replaces the hint.

Basic

<Input.Root>
  <Input.Wrapper>
    <Input.Icon as={SearchIcon} />
    <Input.Input placeholder="Name, email or phone" />
  </Input.Wrapper>
</Input.Root>

Affix and error

<Input.Root hasError>
  <Input.Wrapper><Input.Affix>$</Input.Affix><Input.Input /></Input.Wrapper>
</Input.Root>
<Hint.Root hasError>Above your $2,000 monthly spend cap.</Hint.Root>

Properties

PropTypeDefaultDescription
size"small" | "medium""medium"Height 36 or 40px.
hasErrorbooleanfalseError border and hint tone.
disabledbooleanfalseDisables the field.

Checkbox

Use checkboxes for independent choices. Use a switch when the choice takes effect immediately. The boxes below work: click them.

Basic

<Checkbox.Root defaultChecked id="pause" />
<Label.Root htmlFor="pause">Pause ads that fatigue</Label.Root>

With description

<Checkbox.Root id="spend" defaultChecked />
<div>
  <Label.Root htmlFor="spend">Require approval for spend</Label.Root>
  <Hint.Root>Anything that changes ad budget waits for you.</Hint.Root>
</div>

Properties

PropTypeDefaultDescription
checkedboolean | "indeterminate"—Controlled state.
defaultCheckedbooleanfalseUncontrolled initial state.
onCheckedChange(checked: boolean) => void—Change handler.
disabledbooleanfalseDisables the box.

Switch

A switch takes effect the moment it flips. If the change needs a save, use a checkbox. These switches flip.

Settings rows

YOLO modeCook acts without asking. Every action is still logged.
Approve spendBudget changes wait for you.
Morning briefPost a summary at 6:00 every day.
Approval pingsNotify me on the phone.
<Switch.Root checked={yolo} onCheckedChange={setYolo} />

Properties

PropTypeDefaultDescription
checkedboolean—Controlled state.
defaultCheckedbooleanfalseUncontrolled state.
onCheckedChange(checked: boolean) => void—Change handler.
disabledbooleanfalseDisables the switch.

Segmented Tabs

A segmented control switches a view in place. A tab menu switches between sections of a page.

Segmented control

HourDayWeekMonthOutlineDuotoneFilled
<SegmentedControl.Root defaultValue="day">
  <SegmentedControl.List>
    <SegmentedControl.Trigger value="hour">Hour</SegmentedControl.Trigger>
    <SegmentedControl.Trigger value="day">Day</SegmentedControl.Trigger>
  </SegmentedControl.List>
</SegmentedControl.Root>

Tab menu

OverviewFunnelsAdsLeadsRoutines
<TabMenuHorizontal.Root defaultValue="overview">
  <TabMenuHorizontal.List>
    <TabMenuHorizontal.Trigger value="overview"><ReportsChartIcon /> Overview</TabMenuHorizontal.Trigger>
  </TabMenuHorizontal.List>
</TabMenuHorizontal.Root>

Properties

PropTypeDefaultDescription
valuestring—Controlled active segment.
defaultValuestring—Uncontrolled initial segment.
onValueChange(value: string) => void—Change handler.

Composer

Ask like you would ask a teammate. The composer picks a department, takes files, and sends with Enter.

Chat composer

Chief of Staff
Chief of StaffMorning. Marketing paused 3 fatigued ads overnight and Sales booked 4 calls. Want the full brief?
Ask Cook or tell it what to do…
MarketingMarketing
<Composer.Root onSubmit={send}>
  <Composer.Input placeholder="Ask Cook or tell it what to do…" />
  <Composer.Footer>
    <DepartmentPicker value={dept} onChange={setDept} />
    <Composer.Attach />
    <Composer.Send />
  </Composer.Footer>
</Composer.Root>

Properties

PropTypeDefaultDescription
onSubmit(text: string, files: File[]) => void—Called on Enter or send.
departmentDeptKey"staff"Who receives the message.
disabledbooleanfalseWhile a reply streams.