@antadesign/anta
    Preparing search index...

    Interface CheckboxPropsUnreviewed

    Common props for JSX component wrappers.

    interface CheckboxProps {
        label?: string;
        hint?: ReactNode;
        checked?: CheckboxValue;
        defaultChecked?: CheckboxValue;
        disabled?: boolean;
        round?: boolean | number | string;
        name?: string;
        value?: string;
        tone?:
            | "brand"
            | "neutral"
            | "info"
            | "success"
            | "warning"
            | "critical"
            | string & {};
        toneScope?: ToneScope;
        size?: "small"
        | "medium"
        | "large";
        onStateChange?: (
            event: StateChangeEvent,
            detail: { next: CheckboxValue; prev: CheckboxValue },
        ) => void;
        onChange?: (event: Event) => void;
        onValueChange?: (event: Event, attrs: CheckboxChangeAttrs) => void;
        className?: string;
        style?: CSSProperties;
        children?: ReactNode;
        id?: string;
        title?: string;
        slot?: string;
        tabIndex?: number;
        key?: string | number | null;
        [key: `data-${string}`]: unknown;
        [key: `aria-${string}`]: unknown;
    }

    Hierarchy (View Summary)

    Indexable

    • [key: `data-${string}`]: unknown

      Any data-* attribute is forwarded to the rendered element.

    • [key: `aria-${string}`]: unknown

      Any aria-* attribute is forwarded to the rendered element.

    Index
    label?: string

    Visible label — the value of the checkbox (clicked along with the box). Convenience for the common single-string case; for richer content (markup, a link, an info icon) use children. When both are supplied, label renders first. Required unless children or aria-label is provided (a role="checkbox" takes its name from the author, not the markup).

    hint?: ReactNode

    Secondary text rendered under the label and exposed as the checkbox's accessible description. Not part of the accessible name.

    checked?: CheckboxValue

    Controlled checked state. When provided the checkbox is controlled — it renders exactly this and never self-applies; onStateChange is a request the consumer accepts by updating this prop. Use defaultChecked for an uncontrolled checkbox. 'indeterminate' shows the minus glyph and takes visual precedence; clicking it requests true.

    defaultChecked?: CheckboxValue

    Initial checked state for an uncontrolled checkbox. Read once; later changes are ignored and the element updates its state after interaction.

    false
    
    disabled?: boolean

    Disable the checkbox (no interaction, dropped from the tab order).

    round?: boolean | number | string

    Round the checkbox mark to a circle (border-radius: 999px on the box). Pass a number (px) or a CSS length string for a rounded-square mark instead.

    name?: string

    Form field name. Inside a <form> the checkbox submits under this name, contributing value when checked — like a native checkbox.

    value?: string

    Value submitted with the form when checked — like a native checkbox.

    "on"
    
    tone?:
        | "brand"
        | "neutral"
        | "info"
        | "success"
        | "warning"
        | "critical"
        | string & {}

    Color of the mark. In the default all scope this colors the checked-box fill and unselected box border. A named tone or any literal CSS color ('#ff1493', 'rebeccapurple') for a one-off custom tone. Named tones track light/dark mode automatically; a custom color keeps its hue + chroma and pins lightness to the fill curve. Set toneScope="selected" to tone only the checked mark and leave the empty box neutral. The label + hint stay neutral — recolor them in plain CSS via the theme-aware --text-N-{tone} tokens.

    'neutral'
    
    toneScope?: ToneScope

    Apply tone to every state, or only while checked so the empty box stays neutral. selected is useful when a tinted resting border would read as a validation state.

    'all'
    
    size?: "small" | "medium" | "large"

    Size variant. small=14px, medium=16px, large=18px box.

    'medium'
    
    onStateChange?: (
        event: StateChangeEvent,
        detail: { next: CheckboxValue; prev: CheckboxValue },
    ) => void

    Fired on click / Space before the element applies any change. Event-first so event.preventDefault() is the synchronous veto (uncontrolled mode); detail carries { next, prev }. In controlled mode the element never self-applies — answer by updating checked, reject by doing nothing.

    onChange?: (event: Event) => void

    Fired after the checked state changes — a native change event (the post-apply counterpart to onStateChange). Not cancelable. For a controlled checkbox this fires once you've updated checked.

    onValueChange?: (event: Event, attrs: CheckboxChangeAttrs) => void

    Like onChange, but with a { checked, indeterminate, name, value } snapshot as the second argument, matching Input's onValueChange.

    className?: string

    CSS class on the component's root element (merged with the component's own classes). Use it directly for layout and positioning — grid/flex placement, margins, alignment — rather than wrapping the component in a <div>/<span>.

    style?: CSSProperties

    Inline styles on the component's root element. Set layout/positioning here (or via className) directly on the component instead of adding a wrapper.

    children?: ReactNode

    Child elements. When provided, replaces the component's default label/content.

    id?: string

    HTML id attribute.

    title?: string

    HTML title attribute — native browser tooltip on hover.

    slot?: string

    Assigns the element to a named <slot> of a parent web component (e.g. slot="header" inside a <Card>, slot="footer" inside a <Dialog>).

    tabIndex?: number

    Tab order. Set to -1 to skip the element when tabbing.

    key?: string | number | null

    React/Preact reconciliation key when rendered inside a list. Consumed by the JSX runtime (not forwarded as a DOM attribute).