feat: create simple checkbox

This commit is contained in:
Andrey Sychev
2025-02-12 14:59:19 +01:00
parent 74241c0b5f
commit 0ed231c672
5 changed files with 36 additions and 3 deletions
@@ -27,8 +27,6 @@
cursor: not-allowed;
opacity: 0.5;
}
}
.btn-primary {
@@ -0,0 +1,15 @@
@import '../index.css';
.checkbox {
accent-color: var(--checkbox-background);
width: 16px;
height: 16px;
}
.checkbox-label {
display: inline-flex;
align-items: center;
gap: --spacing(1);
margin-left: 0.5rem;
color: var(--checkbox-foreground);
}
@@ -0,0 +1,16 @@
import { Checkbox as AriaCheckbox, type CheckboxProps } from '@ariakit/react';
import './Checkbox.css';
interface UIKitCheckboxProps extends CheckboxProps {
children?: React.ReactNode;
Label?: React.ReactNode;
}
export function Checkbox({ className, children, ...props }: CheckboxProps) {
return (
<label className="checkbox-label">
<AriaCheckbox className={className ?? '' + ' ' + 'checkbox'} {...props} />
{children}
</label>
);
}
@@ -0,0 +1,3 @@
import { Checkbox } from './Checkbox.js';
export const CheckboxStory = () => <Checkbox> Checkbox </Checkbox>;
+2 -1
View File
@@ -7,4 +7,5 @@
*/
import './index.css';
export { Button } from './Button/Button.js';
export { Button } from './Button/Button.js';
export { Checkbox } from './Checkbox/Checkbox.js';