Files
deepseek-harness/packages/client/ui-primitives/src/Checkbox.tsx
T
07akioni 93b832f1b0 Merge pull request #4459 from deepseek-harness/feat/desktop-onboarding
feat(desktop): add device-local account onboarding
2026-09-23 22:21:18 +08:00

32 lines
1.1 KiB
TypeScript

/** Controlled native checkbox with a caller-owned visible and accessible label. */
import clsx from 'clsx'
import css from './Checkbox.module.css'
/**
* Render a labeled checkbox with native keyboard and form semantics.
* @param props.checked - current checked state.
* @param props.onChange - receives the requested checked state.
* @param props.label - localized visible and accessible label.
* @param props.disabled - whether the control refuses changes.
* @param props.title - optional localized hover text.
* @param props.className - extra class for the label's placement.
* @returns the label containing its checkbox.
*/
export function Checkbox({ checked, onChange, label, disabled = false, title, className }: {
checked: boolean
onChange: (next: boolean) => void
label: string
disabled?: boolean
title?: string | undefined
className?: string | undefined
}) {
return (
<label className={clsx(css.checkbox, className)} title={title}>
<input type="checkbox" checked={checked} disabled={disabled}
onChange={(event) => { onChange(event.target.checked) }} />
<span>{label}</span>
</label>
)
}