StatusCheckbox
Multi-state checkbox that snaps between first/last on click and cycles through all states with Ctrl/Cmd+click. Each state can use an Iconify icon and a CSS color.
import { StatusCheckbox } from "phoundry-ui";Default three states
Loading interactive example…
View source
<script lang="ts"> import { StatusCheckbox } from "phoundry-ui";
let basic = $state("unchecked");</script>
<div class="flex items-center gap-3"> <StatusCheckbox bind:activeKey={basic} /> <span class="text-sm text-txt-secondary" >Key: <code class="text-txt-primary">{basic}</code></span ></div><p class="text-xs text-txt-tertiary"> Click to snap between unchecked and checked; Ctrl/Cmd+click cycles all states.</p>Custom workflow states
Loading interactive example…
View source
<script lang="ts"> import { StatusCheckbox } from "phoundry-ui"; import type { StatusCheckboxStateDef } from "phoundry-ui";
let workflow = $state("todo");
const workflowStates: StatusCheckboxStateDef[] = [ { key: "todo", label: "Todo" }, { key: "in_progress", label: "In progress", icon: "carbon:subtract", color: "var(--color-option-yellow)", }, { key: "done", label: "Done", icon: "carbon:checkmark", color: "var(--color-option-green)", }, ];</script>
<div class="flex items-center gap-3"> <StatusCheckbox bind:activeKey={workflow} states={workflowStates} ariaLabelPrefix="Task" /> <span class="text-sm text-txt-secondary" >Key: <code class="text-txt-primary">{workflow}</code></span ></div>API
From phoundry-ui@0.4.21
| Name | Type | Default | Description |
|---|---|---|---|
activeKeyrequiredbindable | string | — | Current state key (bindable) |
states | StatusCheckboxStateDef[] | — | Ordered states for cycle/snap; defaults to unchecked / indeterminate / checked |
fallbackChar | string | — | Character shown when activeKey is not in states (gray box) |
disabled | boolean | false | Prevents interaction |
size | "sm" | "md" | 'sm' | Indicator box (~14px sm / ~16px md display size) |
ariaLabelPrefix | string | — | Prepended to state label for aria-label (e.g. "Task") |
onchange | (key: string, event?: MouseEvent | undefined) => void | — | Called after cycle or snap with the new key |
class | ClassValue | — | Additional CSS classes on the button |
style | string | — | Inline styles on the component styling target described below. |
elementbindable | HTMLButtonElement | — | Bindable reference to the control button |
Styling
.ph-status-checkbox is the stable root identification hook. Styling is component-local vanilla CSS; data-size always identifies the selected size. class and style apply to the button. Indicator sizes use --ph-indicator-sm (0.875rem) and --ph-indicator-md (1rem), with --ph-comp-icon-xs / --ph-comp-icon-sm for icons. --ph-indicator-icon-filter controls the shared icon shadow. State colors still come from each state definition; state cycling and binding are unchanged. Internal part selectors and --_ph-* properties are implementation details. Filled indicators use the active Theme’s --text-on-accent foreground.