mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
24 lines
598 B
TypeScript
24 lines
598 B
TypeScript
import { CheckboxProps, FormControl, Checkbox as PrimerCheckbox } from '@primer/react'
|
|
import React from 'react'
|
|
|
|
export function Checkbox({
|
|
label,
|
|
value,
|
|
onChange,
|
|
checked = value,
|
|
...rest
|
|
}: Override<CheckboxProps, { label: React.ReactNode } & IO<boolean>>) {
|
|
return (
|
|
<FormControl disabled={rest.disabled}>
|
|
<PrimerCheckbox
|
|
sx={{
|
|
marginTop: '4px', // align label
|
|
}}
|
|
checked={checked}
|
|
onChange={e => onChange(e.target.checked)}
|
|
{...rest}
|
|
/>
|
|
<FormControl.Label>{label}</FormControl.Label>
|
|
</FormControl>
|
|
)
|
|
}
|