Saltar al contenido
El Muestrario

componente · @solu30/ui-kit/input

Checkbox

El componente, montado

Cargando el espécimen…

Cargando el chunk del paquete instalado…

De dónde se importa

import { Checkbox } from '@solu30/ui-kit/input'

Props

11 props declaradas en los tipos de la versión instalada.
PropRequeridaTipoQué hace
checkedbooleanWhether the checkbox is checked
onChangeopcional(checked: boolean, event?: React__default.ChangeEvent<HTMLInputElement>) => void | Promise<void>Callback when the checkbox state changes. Supports sync and async — if a Promise is returned, optimistic UI is applied: the visual state flips immediately and reverts on rejection.
onCheckedChangeopcional(checked: boolean) => void | Promise<void>Radix-compatible alias for onChange — accepts (checked: boolean)
labelopcionalReact__default.ReactNodeLabel for the checkbox
erroropcionalstringError message to display
classNameopcionalstringAdditional CSS class
helpTextopcionalstringHelp text to display below the checkbox
descriptionopcionalstringDescription sub-label rendered below the main label (alias for helpText, mirrors the TCP bridge API for drop-in compatibility).
fullWidthopcionalbooleanWhether the checkbox should take full width
iconopcionalReact__default.ReactNodeOptional icon rendered before the label text (emoji or React element). @example icon="🥗" @example icon={<Wifi size={18} />}
isLoadingopcionalbooleanExternal loading state. When true, disables interaction and shows a loading indicator inside the checkbox box.

Ejemplo del paquete

/
icon?: React__default.ReactNode;
/**
External loading state. When true, disables interaction and shows a
loading indicator inside the checkbox box.
/
isLoading?: boolean;
}
/**
Accessible checkbox component with custom SVG rendering, label support,
async/optimistic onChange, icon slot, and loading state.
Uses CSS variables for theming:
- `--ui-accent` for checked state background/border
- `--ui-border` for unchecked border
- `--ui-content-primary` for label text
- `--ui-content-secondary` for help text
// Basic usage (unchanged)
<Checkbox
label="Accept terms and conditions"
checked={accepted}
onChange={setAccepted}
/>
// Async / optimistic — visual flip is instant, reverts on error
<Checkbox
label="Vegetarian"
checked={dietaryVegetarian}
onChange={async (checked) => {
await api.savePreference('dietaryVegetarian', checked)
}}
/>
// With icon slot
<Checkbox
label="WiFi Included"
icon={<Wifi size={18} />}
checked={hasWifi}
onChange={setHasWifi}
/>
// With description sub-label
<Checkbox
label="Transfer Needed"
description="Guest requires airport transfer"
checked={transferNeeded}
isLoading={isSaving}
onChange={handleSave}
/>

Del @example del JSDoc de @solu30/ui-kit, sin editar. Cuatro de los 69 ejemplos del paquete traen pegada la firma cruda del .d.ts —el mismo defecto del extractor que se come las descripciones—, y por eso la caja tiene tope de alto: el ejemplo de verdad suele estar al final.