Skip to content

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
default-three-states.svelte
<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
custom-workflow-states.svelte
<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

NameTypeDefaultDescription
activeKeyrequiredbindablestring—Current state key (bindable)
statesStatusCheckboxStateDef[]—Ordered states for cycle/snap; defaults to unchecked / indeterminate / checked
fallbackCharstring—Character shown when activeKey is not in states (gray box)
disabledbooleanfalsePrevents interaction
size"sm" | "md"'sm'Indicator box (~14px sm / ~16px md display size)
ariaLabelPrefixstring—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
classClassValue—Additional CSS classes on the button
stylestring—Inline styles on the component styling target described below.
elementbindableHTMLButtonElement—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.

Documentation is licensed under CC BY 4.0. Phoundry names and marks remain reserved.