@gebeta/ui 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +20 -2
- package/dist/components/Badge/Badge.d.ts +25 -0
- package/dist/components/Badge/Badge.d.ts.map +1 -0
- package/dist/components/Badge/Badge.js +26 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/Badge/Badge.module.js +9 -0
- package/dist/components/Badge/Badge.module.js.map +1 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Badge/index.d.ts.map +1 -0
- package/dist/components/Button/Button.d.ts +32 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.js +39 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/Button.module.js +9 -0
- package/dist/components/Button/Button.module.js.map +1 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +13 -0
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox/Checkbox.js +65 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.module.js +13 -0
- package/dist/components/Checkbox/Checkbox.module.js.map +1 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -0
- package/dist/components/Dialog/Dialog.d.ts +52 -0
- package/dist/components/Dialog/Dialog.d.ts.map +1 -0
- package/dist/components/Dialog/Dialog.js +78 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/Dialog/Dialog.module.js +15 -0
- package/dist/components/Dialog/Dialog.module.js.map +1 -0
- package/dist/components/Dialog/index.d.ts +2 -0
- package/dist/components/Dialog/index.d.ts.map +1 -0
- package/dist/components/Spinner/Spinner.d.ts +22 -0
- package/dist/components/Spinner/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner/Spinner.js +40 -0
- package/dist/components/Spinner/Spinner.js.map +1 -0
- package/dist/components/Spinner/Spinner.module.js +13 -0
- package/dist/components/Spinner/Spinner.module.js.map +1 -0
- package/dist/components/Spinner/index.d.ts +2 -0
- package/dist/components/Spinner/index.d.ts.map +1 -0
- package/dist/components/Switch/Switch.d.ts +17 -0
- package/dist/components/Switch/Switch.d.ts.map +1 -0
- package/dist/components/Switch/Switch.js +27 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Switch/Switch.module.js +11 -0
- package/dist/components/Switch/Switch.module.js.map +1 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch/index.d.ts.map +1 -0
- package/dist/components/TextField/TextField.d.ts +37 -0
- package/dist/components/TextField/TextField.d.ts.map +1 -0
- package/dist/components/TextField/TextField.js +59 -0
- package/dist/components/TextField/TextField.js.map +1 -0
- package/dist/components/TextField/TextField.module.js +15 -0
- package/dist/components/TextField/TextField.module.js.map +1 -0
- package/dist/components/TextField/index.d.ts +2 -0
- package/dist/components/TextField/index.d.ts.map +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +31 -0
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip/Tooltip.js +29 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.module.js +10 -0
- package/dist/components/Tooltip/Tooltip.module.js.map +1 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/Tooltip/index.d.ts.map +1 -0
- package/dist/docs/components/Badge.md +45 -0
- package/dist/docs/components/Button.md +60 -0
- package/dist/docs/components/Checkbox.md +65 -0
- package/dist/docs/components/Dialog.md +161 -0
- package/dist/docs/components/Spinner.md +33 -0
- package/dist/docs/components/Switch.md +59 -0
- package/dist/docs/components/TextField.md +65 -0
- package/dist/docs/components/Tooltip.md +63 -0
- package/dist/docs/index.md +58 -0
- package/dist/docs/tokens.md +33 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/styles.css +2 -0
- package/dist/utils/class-names.d.ts +8 -0
- package/dist/utils/class-names.d.ts.map +1 -0
- package/dist/utils/class-names.js +10 -0
- package/dist/utils/class-names.js.map +1 -0
- package/package.json +76 -3
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/components/Spinner/Spinner.module.css
|
|
3
|
+
var e = "gb-spinner", t = "gb-spinner-svg", n = "gb-spinner-spin", r = "gb-spinner-track", i = "gb-spinner-arc", a = "gb-spinner-label", o = {
|
|
4
|
+
root: e,
|
|
5
|
+
svg: t,
|
|
6
|
+
spin: n,
|
|
7
|
+
track: r,
|
|
8
|
+
arc: i,
|
|
9
|
+
label: a
|
|
10
|
+
};
|
|
11
|
+
export { i as arc, o as default, a as label, e as root, n as spin, t as svg, r as track };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=Spinner.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.module.js","names":["root","svg","spin","track","arc","label","Spinner_module_default"],"sources":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Spinner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { Switch as BaseSwitch } from '@base-ui/react/switch';
|
|
3
|
+
export type SwitchSize = 'sm' | 'md';
|
|
4
|
+
export interface SwitchProps extends Omit<BaseSwitch.Root.Props, 'className'> {
|
|
5
|
+
/** Visible label. If omitted, pass `aria-label`. */
|
|
6
|
+
label?: ReactNode;
|
|
7
|
+
/** @default 'md' */
|
|
8
|
+
size?: SwitchSize;
|
|
9
|
+
/** Class for the outer <label>. */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* WRAPS Base UI `Switch`. Use for settings that apply immediately
|
|
14
|
+
* (use Checkbox for choices that are submitted with a form).
|
|
15
|
+
*/
|
|
16
|
+
export declare const Switch: import("react").ForwardRefExoticComponent<Omit<SwitchProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
17
|
+
//# sourceMappingURL=Switch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAI7D,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAErC,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC;IAC3E,oDAAoD;IACpD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,oBAAoB;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,kHAkBjB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../../utils/class-names.js";
|
|
3
|
+
import t from "./Switch.module.js";
|
|
4
|
+
import { forwardRef as n } from "react";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
import { Switch as a } from "@base-ui/react/switch";
|
|
7
|
+
// src/components/Switch/Switch.tsx
|
|
8
|
+
var o = n(function({ label: n, size: o = "md", className: s, ...c }, l) {
|
|
9
|
+
let u = /* @__PURE__ */ r(a.Root, {
|
|
10
|
+
ref: l,
|
|
11
|
+
className: t.track,
|
|
12
|
+
"data-size": o,
|
|
13
|
+
...c,
|
|
14
|
+
children: /* @__PURE__ */ r(a.Thumb, { className: t.thumb })
|
|
15
|
+
});
|
|
16
|
+
return n ? /* @__PURE__ */ i("label", {
|
|
17
|
+
className: e(t.root, s),
|
|
18
|
+
"data-disabled": c.disabled || void 0,
|
|
19
|
+
children: [u, /* @__PURE__ */ r("span", {
|
|
20
|
+
className: t.label,
|
|
21
|
+
children: n
|
|
22
|
+
})]
|
|
23
|
+
}) : u;
|
|
24
|
+
});
|
|
25
|
+
export { o as Switch };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=Switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch.js","names":["Switch","BaseSwitch","styles","Switch_module_default","Switch$1","forwardRef","props","control","Switch","size","label","cx","className"],"sources":["../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import { forwardRef, type ReactNode } from 'react';\nimport { Switch as BaseSwitch } from '@base-ui/react/switch';\nimport { cx } from '../../utils/class-names';\nimport styles from './Switch.module.css';\n\nexport type SwitchSize = 'sm' | 'md';\n\nexport interface SwitchProps extends Omit<BaseSwitch.Root.Props, 'className'> {\n /** Visible label. If omitted, pass `aria-label`. */\n label?: ReactNode;\n /** @default 'md' */\n size?: SwitchSize;\n /** Class for the outer <label>. */\n className?: string;\n}\n\n/**\n * WRAPS Base UI `Switch`. Use for settings that apply immediately\n * (use Checkbox for choices that are submitted with a form).\n */\nexport const Switch = forwardRef<HTMLElement, SwitchProps>(function Switch(\n { label, size = 'md', className, ...props },\n ref,\n) {\n const control = (\n <BaseSwitch.Root ref={ref} className={styles.track} data-size={size} {...props}>\n <BaseSwitch.Thumb className={styles.thumb} />\n </BaseSwitch.Root>\n );\n\n if (!label) return control;\n\n return (\n <label className={cx(styles.root, className)} data-disabled={props.disabled || undefined}>\n {control}\n <span className={styles.label}>{label}</span>\n </label>\n );\n});\n"],"mappings":";;;;;;;AAoBA,IAAaA,IAASK,EAAqC,SACzD,EAAE,UAAO,UAAO,MAAM,cAAW,GAAGC,KACpC,GACA;CACA,IAAMC,IACJ,kBAACN,EAAW,MAAZ;EAAsB;EAAK,WAAWC,EAAO;EAAO,aAAWO;EAAM,GAAIH;EACvE,UAAA,kBAACL,EAAW,OAAZ,EAAkB,WAAWC,EAAO,MAAQ,CAAA;CAC7B,CAAA;CAKnB,OAFKQ,IAGH,kBAAC,SAAD;EAAO,WAAWC,EAAGT,EAAO,MAAMU,CAAS;EAAG,iBAAeN,EAAM,YAAY,KAAA;EAA/E,UAAA,CACGC,GACD,kBAAC,QAAD;GAAM,WAAWL,EAAO;GAAQ,UAAAQ;EAAY,CAAA,CACvC;C,KANUH;AAQrB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/components/Switch/Switch.module.css
|
|
3
|
+
var e = "gb-switch", t = "gb-switch-track", n = "gb-switch-thumb", r = "gb-switch-label", i = {
|
|
4
|
+
root: e,
|
|
5
|
+
track: t,
|
|
6
|
+
thumb: n,
|
|
7
|
+
label: r
|
|
8
|
+
};
|
|
9
|
+
export { i as default, r as label, e as root, n as thumb, t as track };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=Switch.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch.module.js","names":["root","track","thumb","label","Switch_module_default"],"sources":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { Field } from '@base-ui/react/field';
|
|
3
|
+
import { Input } from '@base-ui/react/input';
|
|
4
|
+
export type TextFieldSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
export interface TextFieldProps extends Omit<Input.Props, 'size' | 'className'> {
|
|
6
|
+
/** Visible label. Required — every input needs an accessible name. */
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
/** Helper text shown under the input. */
|
|
9
|
+
description?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Error message from your own validation (e.g. react-hook-form, server).
|
|
12
|
+
* Setting it marks the field invalid. Native constraint errors
|
|
13
|
+
* (`required`, `type="email"`, …) are shown automatically without this.
|
|
14
|
+
*/
|
|
15
|
+
error?: ReactNode;
|
|
16
|
+
/** @default 'md' */
|
|
17
|
+
size?: TextFieldSize;
|
|
18
|
+
/** Content inside the input box, before the text (icon, currency…). */
|
|
19
|
+
startAdornment?: ReactNode;
|
|
20
|
+
/** Content inside the input box, after the text. */
|
|
21
|
+
endAdornment?: ReactNode;
|
|
22
|
+
/** Base UI per-field validation function. */
|
|
23
|
+
validate?: Field.Root.Props['validate'];
|
|
24
|
+
/** When validation runs. @default 'onSubmit' */
|
|
25
|
+
validationMode?: Field.Root.Props['validationMode'];
|
|
26
|
+
/** Class for the outer wrapper. */
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* WRAPS Base UI `Field` + `Input`. Field wires up label ↔ input ↔ description ↔
|
|
31
|
+
* error with the right ids and aria attributes, and runs constraint validation.
|
|
32
|
+
*
|
|
33
|
+
* Props you'd put on an <input> (name, type, placeholder, value, onChange,
|
|
34
|
+
* required…) go straight to the input. `ref` points at the <input>.
|
|
35
|
+
*/
|
|
36
|
+
export declare const TextField: import("react").ForwardRefExoticComponent<Omit<TextFieldProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
37
|
+
//# sourceMappingURL=TextField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAI7C,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/C,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC;IAC7E,sEAAsE;IACtE,KAAK,EAAE,SAAS,CAAC;IACjB,yCAAyC;IACzC,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,oBAAoB;IACpB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,uEAAuE;IACvE,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,oDAAoD;IACpD,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACxC,gDAAgD;IAChD,cAAc,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACpD,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,0HAwDpB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx as e } from "../../utils/class-names.js";
|
|
3
|
+
import t from "./TextField.module.js";
|
|
4
|
+
import { forwardRef as n } from "react";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
import { Field as a } from "@base-ui/react/field";
|
|
7
|
+
import { Input as o } from "@base-ui/react/input";
|
|
8
|
+
// src/components/TextField/TextField.tsx
|
|
9
|
+
var s = n(function({ label: n, description: s, error: c, size: l = "md", startAdornment: u, endAdornment: d, validate: f, validationMode: p, disabled: m, className: h, ...g }, _) {
|
|
10
|
+
let v = c != null && c !== !1 && c !== "";
|
|
11
|
+
return /* @__PURE__ */ i(a.Root, {
|
|
12
|
+
className: e(t.root, h),
|
|
13
|
+
disabled: m,
|
|
14
|
+
invalid: v || void 0,
|
|
15
|
+
validate: f,
|
|
16
|
+
validationMode: p,
|
|
17
|
+
"data-size": l,
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ i(a.Label, {
|
|
20
|
+
className: t.label,
|
|
21
|
+
children: [n, g.required && /* @__PURE__ */ r("span", {
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
className: t.required,
|
|
24
|
+
children: " *"
|
|
25
|
+
})]
|
|
26
|
+
}),
|
|
27
|
+
/* @__PURE__ */ i("div", {
|
|
28
|
+
className: t.control,
|
|
29
|
+
children: [
|
|
30
|
+
u && /* @__PURE__ */ r("span", {
|
|
31
|
+
className: t.adornment,
|
|
32
|
+
children: u
|
|
33
|
+
}),
|
|
34
|
+
/* @__PURE__ */ r(o, {
|
|
35
|
+
ref: _,
|
|
36
|
+
className: t.input,
|
|
37
|
+
...g
|
|
38
|
+
}),
|
|
39
|
+
d && /* @__PURE__ */ r("span", {
|
|
40
|
+
className: t.adornment,
|
|
41
|
+
children: d
|
|
42
|
+
})
|
|
43
|
+
]
|
|
44
|
+
}),
|
|
45
|
+
s && /* @__PURE__ */ r(a.Description, {
|
|
46
|
+
className: t.description,
|
|
47
|
+
children: s
|
|
48
|
+
}),
|
|
49
|
+
v ? /* @__PURE__ */ r(a.Error, {
|
|
50
|
+
className: t.error,
|
|
51
|
+
match: !0,
|
|
52
|
+
children: c
|
|
53
|
+
}) : /* @__PURE__ */ r(a.Error, { className: t.error })
|
|
54
|
+
]
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
export { s as TextField };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=TextField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.js","names":["styles","TextField_module_default","TextField","forwardRef","inputProps","hasExternalError","error","Field","cx","className","size","label","startAdornment","Input","endAdornment","description"],"sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import { forwardRef, type ReactNode } from 'react';\nimport { Field } from '@base-ui/react/field';\nimport { Input } from '@base-ui/react/input';\nimport { cx } from '../../utils/class-names';\nimport styles from './TextField.module.css';\n\nexport type TextFieldSize = 'sm' | 'md' | 'lg';\n\nexport interface TextFieldProps extends Omit<Input.Props, 'size' | 'className'> {\n /** Visible label. Required — every input needs an accessible name. */\n label: ReactNode;\n /** Helper text shown under the input. */\n description?: ReactNode;\n /**\n * Error message from your own validation (e.g. react-hook-form, server).\n * Setting it marks the field invalid. Native constraint errors\n * (`required`, `type=\"email\"`, …) are shown automatically without this.\n */\n error?: ReactNode;\n /** @default 'md' */\n size?: TextFieldSize;\n /** Content inside the input box, before the text (icon, currency…). */\n startAdornment?: ReactNode;\n /** Content inside the input box, after the text. */\n endAdornment?: ReactNode;\n /** Base UI per-field validation function. */\n validate?: Field.Root.Props['validate'];\n /** When validation runs. @default 'onSubmit' */\n validationMode?: Field.Root.Props['validationMode'];\n /** Class for the outer wrapper. */\n className?: string;\n}\n\n/**\n * WRAPS Base UI `Field` + `Input`. Field wires up label ↔ input ↔ description ↔\n * error with the right ids and aria attributes, and runs constraint validation.\n *\n * Props you'd put on an <input> (name, type, placeholder, value, onChange,\n * required…) go straight to the input. `ref` points at the <input>.\n */\nexport const TextField = forwardRef<HTMLInputElement, TextFieldProps>(function TextField(\n {\n label,\n description,\n error,\n size = 'md',\n startAdornment,\n endAdornment,\n validate,\n validationMode,\n disabled,\n className,\n ...inputProps\n },\n ref,\n) {\n const hasExternalError = error != null && error !== false && error !== '';\n\n return (\n <Field.Root\n className={cx(styles.root, className)}\n disabled={disabled}\n invalid={hasExternalError || undefined}\n validate={validate}\n validationMode={validationMode}\n data-size={size}\n >\n <Field.Label className={styles.label}>\n {label}\n {inputProps.required && (\n <span aria-hidden=\"true\" className={styles.required}>\n {' *'}\n </span>\n )}\n </Field.Label>\n\n <div className={styles.control}>\n {startAdornment && <span className={styles.adornment}>{startAdornment}</span>}\n <Input ref={ref} className={styles.input} {...inputProps} />\n {endAdornment && <span className={styles.adornment}>{endAdornment}</span>}\n </div>\n\n {description && (\n <Field.Description className={styles.description}>{description}</Field.Description>\n )}\n\n {hasExternalError ? (\n <Field.Error className={styles.error} match>\n {error}\n </Field.Error>\n ) : (\n // No children → Base UI shows the browser's validation message.\n <Field.Error className={styles.error} />\n )}\n </Field.Root>\n );\n});\n"],"mappings":";;;;;;;;AAwCA,IAAaE,IAAYC,EAA6C,SACpE,EACE,UACA,gBACA,UACA,UAAO,MACP,mBACA,iBACA,aACA,mBACA,aACA,cACA,GAAGC,KAEL,GACA;CACA,IAAMC,IAAmBC,KAAS,QAAQA,MAAU,MAASA,MAAU;CAEvE,OACE,kBAACC,EAAM,MAAP;EACE,WAAWC,EAAGR,EAAO,MAAMS,CAAS;EAC1B;EACV,SAASJ,KAAoB,KAAA;EACnB;EACM;EAChB,aAAWK;EANb,UAAA;GAQE,kBAACH,EAAM,OAAP;IAAa,WAAWP,EAAO;IAA/B,UAAA,CACGW,GACAP,EAAW,YACV,kBAAC,QAAD;KAAM,eAAY;KAAO,WAAWJ,EAAO;KACxC,UAAA;IACG,CAAA,CAEG;;GAEb,kBAAC,OAAD;IAAK,WAAWA,EAAO;IAAvB,UAAA;KACGY,KAAkB,kBAAC,QAAD;MAAM,WAAWZ,EAAO;MAAY,UAAAY;KAAqB,CAAA;KAC5E,kBAACC,GAAD;MAAY;MAAK,WAAWb,EAAO;MAAO,GAAII;KAAa,CAAA;KAC1DU,KAAgB,kBAAC,QAAD;MAAM,WAAWd,EAAO;MAAY,UAAAc;KAAmB,CAAA;IACrE;;GAEJC,KACC,kBAACR,EAAM,aAAP;IAAmB,WAAWP,EAAO;IAAc,UAAAe;GAA+B,CAAA;GAGnFV,IACC,kBAACE,EAAM,OAAP;IAAa,WAAWP,EAAO;IAAO,OAAA;IACnC,UAAAM;GACU,CAAA,IAGb,kBAACC,EAAM,OAAP,EAAa,WAAWP,EAAO,MAAQ,CAAA;EAE/B;;AAEhB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/components/TextField/TextField.module.css
|
|
3
|
+
var e = "gb-text-field", t = "gb-text-field-label", n = "gb-text-field-required", r = "gb-text-field-control", i = "gb-text-field-input", a = "gb-text-field-adornment", o = "gb-text-field-description", s = "gb-text-field-error", c = {
|
|
4
|
+
root: e,
|
|
5
|
+
label: t,
|
|
6
|
+
required: n,
|
|
7
|
+
control: r,
|
|
8
|
+
input: i,
|
|
9
|
+
adornment: a,
|
|
10
|
+
description: o,
|
|
11
|
+
error: s
|
|
12
|
+
};
|
|
13
|
+
export { a as adornment, r as control, c as default, o as description, s as error, i as input, t as label, n as required, e as root };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=TextField.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.module.js","names":["root","label","required","control","input","adornment","description","error","TextField_module_default"],"sources":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
export interface TooltipProps {
|
|
3
|
+
/** Tooltip text. Keep it short — tooltips can't hold interactive content. */
|
|
4
|
+
content: ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* The trigger. Must be a single element that accepts a ref and props
|
|
7
|
+
* (a DOM element or one of our components).
|
|
8
|
+
*/
|
|
9
|
+
children: ReactElement;
|
|
10
|
+
/** @default 'top' */
|
|
11
|
+
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
12
|
+
/** Distance from the trigger in px. @default 8 */
|
|
13
|
+
sideOffset?: number;
|
|
14
|
+
/** Hover delay in ms. Overrides TooltipProvider. */
|
|
15
|
+
delay?: number;
|
|
16
|
+
open?: boolean;
|
|
17
|
+
defaultOpen?: boolean;
|
|
18
|
+
onOpenChange?: (open: boolean) => void;
|
|
19
|
+
/** Disable the tooltip without removing it. */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* WRAPS Base UI `Tooltip` with a one-line API:
|
|
24
|
+
*
|
|
25
|
+
* <Tooltip content="Copy tracking link"><Button …/></Tooltip>
|
|
26
|
+
*
|
|
27
|
+
* Wrap your app in <TooltipProvider> so moving between tooltips skips the delay.
|
|
28
|
+
*/
|
|
29
|
+
export declare function Tooltip({ content, children, side, sideOffset, delay, open, defaultOpen, onOpenChange, disabled, }: TooltipProps): import("react").JSX.Element;
|
|
30
|
+
export declare const TooltipProvider: import("react").FC<import("@base-ui/react").TooltipProviderProps>;
|
|
31
|
+
//# sourceMappingURL=Tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIrD,MAAM,WAAW,YAAY;IAC3B,6EAA6E;IAC7E,OAAO,EAAE,SAAS,CAAC;IACnB;;;OAGG;IACH,QAAQ,EAAE,YAAY,CAAC;IACvB,qBAAqB;IACrB,IAAI,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IAC3C,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,QAAQ,EACR,IAAY,EACZ,UAAc,EACd,KAAK,EACL,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,QAAQ,GACT,EAAE,YAAY,+BAmBd;AAED,eAAO,MAAM,eAAe,mEAAuB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import e from "./Tooltip.module.js";
|
|
3
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
|
+
import { Tooltip as r } from "@base-ui/react/tooltip";
|
|
5
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
6
|
+
function i({ content: i, children: a, side: o = "top", sideOffset: s = 8, delay: c, open: l, defaultOpen: u, onOpenChange: d, disabled: f }) {
|
|
7
|
+
return /* @__PURE__ */ n(r.Root, {
|
|
8
|
+
open: l,
|
|
9
|
+
defaultOpen: u,
|
|
10
|
+
onOpenChange: d ? (e) => d(e) : void 0,
|
|
11
|
+
disabled: f,
|
|
12
|
+
children: [/* @__PURE__ */ t(r.Trigger, {
|
|
13
|
+
render: a,
|
|
14
|
+
delay: c
|
|
15
|
+
}), /* @__PURE__ */ t(r.Portal, { children: /* @__PURE__ */ t(r.Positioner, {
|
|
16
|
+
side: o,
|
|
17
|
+
sideOffset: s,
|
|
18
|
+
className: e.positioner,
|
|
19
|
+
children: /* @__PURE__ */ n(r.Popup, {
|
|
20
|
+
className: e.popup,
|
|
21
|
+
children: [/* @__PURE__ */ t(r.Arrow, { className: e.arrow }), i]
|
|
22
|
+
})
|
|
23
|
+
}) })]
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
var a = r.Provider;
|
|
27
|
+
export { i as Tooltip, a as TooltipProvider };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.js","names":["Tooltip","BaseTooltip","styles","Tooltip_module_default","Tooltip$1","Tooltip","onOpenChange","o","children","content","TooltipProvider"],"sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import type { ReactElement, ReactNode } from 'react';\nimport { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';\nimport styles from './Tooltip.module.css';\n\nexport interface TooltipProps {\n /** Tooltip text. Keep it short — tooltips can't hold interactive content. */\n content: ReactNode;\n /**\n * The trigger. Must be a single element that accepts a ref and props\n * (a DOM element or one of our components).\n */\n children: ReactElement;\n /** @default 'top' */\n side?: 'top' | 'bottom' | 'left' | 'right';\n /** Distance from the trigger in px. @default 8 */\n sideOffset?: number;\n /** Hover delay in ms. Overrides TooltipProvider. */\n delay?: number;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** Disable the tooltip without removing it. */\n disabled?: boolean;\n}\n\n/**\n * WRAPS Base UI `Tooltip` with a one-line API:\n *\n * <Tooltip content=\"Copy tracking link\"><Button …/></Tooltip>\n *\n * Wrap your app in <TooltipProvider> so moving between tooltips skips the delay.\n */\nexport function Tooltip({\n content,\n children,\n side = 'top',\n sideOffset = 8,\n delay,\n open,\n defaultOpen,\n onOpenChange,\n disabled,\n}: TooltipProps) {\n return (\n <BaseTooltip.Root\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange ? (o) => onOpenChange(o) : undefined}\n disabled={disabled}\n >\n <BaseTooltip.Trigger render={children} delay={delay} />\n <BaseTooltip.Portal>\n <BaseTooltip.Positioner side={side} sideOffset={sideOffset} className={styles.positioner}>\n <BaseTooltip.Popup className={styles.popup}>\n <BaseTooltip.Arrow className={styles.arrow} />\n {content}\n </BaseTooltip.Popup>\n </BaseTooltip.Positioner>\n </BaseTooltip.Portal>\n </BaseTooltip.Root>\n );\n}\n\nexport const TooltipProvider = BaseTooltip.Provider;\n"],"mappings":";;;;;AAgCA,SAAgBA,EAAQ,EACtB,YACA,aACA,UAAO,OACP,gBAAa,GACb,UACA,SACA,gBACA,iBACA,eACe;CACf,OACE,kBAACC,EAAY,MAAb;EACQ;EACO;EACb,cAAcK,KAAgB,MAAMA,EAAaC,CAAC,IAAI,KAAA;EAC5C;EAJZ,UAAA,CAME,kBAACN,EAAY,SAAb;GAAqB,QAAQO;GAAiB;EAAQ,CAAA,GACtD,kBAACP,EAAY,QAAb,EAAA,UACE,kBAACA,EAAY,YAAb;GAA8B;GAAkB;GAAY,WAAWC,EAAO;GAC5E,UAAA,kBAACD,EAAY,OAAb;IAAmB,WAAWC,EAAO;IAArC,UAAA,CACE,kBAACD,EAAY,OAAb,EAAmB,WAAWC,EAAO,MAAQ,CAAA,GAC5CO,CACgB;;EACG,CAAA,EACN,CAAA,CACJ;;AAEtB;AAEA,IAAaC,IAAkBT,EAAY"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/components/Tooltip/Tooltip.module.css
|
|
3
|
+
var e = "gb-tooltip-positioner", t = "gb-tooltip-popup", n = "gb-tooltip-arrow", r = {
|
|
4
|
+
positioner: e,
|
|
5
|
+
popup: t,
|
|
6
|
+
arrow: n
|
|
7
|
+
};
|
|
8
|
+
export { n as arrow, r as default, t as popup, e as positioner };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=Tooltip.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.module.js","names":["positioner","popup","arrow","Tooltip_module_default"],"sources":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Badge
|
|
2
|
+
|
|
3
|
+
> Small status/category label (Tag). Semantic and hue tones, optional dot.
|
|
4
|
+
|
|
5
|
+
`import { Badge } from '@gebeta/ui';` · custom Gebeta component · @gebeta/ui 0.3.0
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
- Prefer **semantic** tones — they explain _why_: `neutral`, `primary`, `success`, `warning`, `danger`, `info`.
|
|
10
|
+
- Use **hue** tones only for categories with no meaning (zones, teams): `blue`, `purple`, `green`, `red`, `orange`, `amber`, `teal`, `yellow`.
|
|
11
|
+
- `dot` adds a leading status dot. `size`: `sm` | `md`.
|
|
12
|
+
- Not interactive by default. To make it a link use `render={<a href="…" />}`.
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { Badge } from '@gebeta/ui';
|
|
18
|
+
|
|
19
|
+
<Badge tone="success" dot>Driver online</Badge>
|
|
20
|
+
<Badge tone="danger">3 late</Badge>
|
|
21
|
+
<Badge tone="purple" size="sm">Bole</Badge>
|
|
22
|
+
<Badge tone="info" render={<a href="/orders?status=late" />}>View late orders</Badge>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Behaviour details (Base UI 1.9.0)
|
|
26
|
+
|
|
27
|
+
Keyboard, focus, ARIA, events and `data-*` state attributes come from Base UI. Its docs ship in the installed
|
|
28
|
+
`@base-ui/react` package (see "Base UI docs" in index.md to locate it):
|
|
29
|
+
|
|
30
|
+
- `@base-ui/react/docs/react/utils/use-render.md` (~15 KB)
|
|
31
|
+
|
|
32
|
+
These files are large. List headings first (`grep -n '^##' <file>`), then read only the section you need,
|
|
33
|
+
e.g. the `Root Data Attributes` table for styling states like `[data-checked]`.
|
|
34
|
+
|
|
35
|
+
## Props
|
|
36
|
+
|
|
37
|
+
All parts also accept `className` (string or `(state) => string`), `style`, `render` (swap the element) and the native HTML attributes of the rendered element.
|
|
38
|
+
|
|
39
|
+
### Badge
|
|
40
|
+
|
|
41
|
+
| Prop | Type | Default | Description |
|
|
42
|
+
| --- | --- | --- | --- |
|
|
43
|
+
| tone | `"neutral" \| "primary" \| "success" \| "warning" \| "danger" \| "info" \| "blue" \| "purple" \| "green" \| "red" \| "orange" \| "amber" \| "teal" \| "yellow"` | `neutral` | Semantic color. |
|
|
44
|
+
| size | `"sm" \| "md"` | `md` | |
|
|
45
|
+
| dot | `boolean` | `false` | Show a leading status dot. |
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Button
|
|
2
|
+
|
|
3
|
+
> Action trigger. Pill shape, 8 variants, 6 sizes, built-in loading state.
|
|
4
|
+
|
|
5
|
+
`import { Button } from '@gebeta/ui';` · built on Base UI · @gebeta/ui 0.3.0
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
- For **actions** only (save, open, submit). For navigation use your router's `<Link>` / `<a>`.
|
|
10
|
+
- `primary` = the ONE main action in a view. Most other buttons are `secondary`.
|
|
11
|
+
- `ink` = high-emphasis dark button (hero/marketing CTAs). `muted` / `subtle` = toolbars, low emphasis.
|
|
12
|
+
- `danger` = destructive (red text on white). `ghost` = tertiary / icon buttons. `link` = inline text action.
|
|
13
|
+
- `outline` is deprecated → use `secondary`.
|
|
14
|
+
- Sizes: `sm` dense UIs, `md` default, `lg`, `xl` marketing hero, `icon` / `icon-sm` square (requires `aria-label`).
|
|
15
|
+
- Async work → `loading` (keeps focus, sets `aria-busy`), not `disabled`.
|
|
16
|
+
- Submit buttons need `type="submit"` explicitly (default is `type="button"`).
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { Button } from '@gebeta/ui';
|
|
22
|
+
|
|
23
|
+
<Button onClick={() => console.log('saved')}>Save</Button>
|
|
24
|
+
<Button variant="secondary" startIcon={<svg aria-hidden />}>Export</Button>
|
|
25
|
+
<Button variant="danger" loading>Deleting…</Button>
|
|
26
|
+
<Button variant="ghost" size="icon" aria-label="Close"><svg aria-hidden /></Button>
|
|
27
|
+
<Button type="submit" size="lg" fullWidth>Sign in</Button>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Behaviour details (Base UI 1.9.0)
|
|
31
|
+
|
|
32
|
+
Keyboard, focus, ARIA, events and `data-*` state attributes come from Base UI. Its docs ship in the installed
|
|
33
|
+
`@base-ui/react` package (see "Base UI docs" in index.md to locate it):
|
|
34
|
+
|
|
35
|
+
- `@base-ui/react/docs/react/components/button.md` (~12 KB)
|
|
36
|
+
|
|
37
|
+
These files are large. List headings first (`grep -n '^##' <file>`), then read only the section you need,
|
|
38
|
+
e.g. the `Root Data Attributes` table for styling states like `[data-checked]`.
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
|
|
42
|
+
All parts also accept `className` (string or `(state) => string`), `style`, `render` (swap the element) and the native HTML attributes of the rendered element.
|
|
43
|
+
|
|
44
|
+
### Button
|
|
45
|
+
|
|
46
|
+
| Prop | Type | Default | Description |
|
|
47
|
+
| --- | --- | --- | --- |
|
|
48
|
+
| variant | `"link" \| "primary" \| "secondary" \| "ink" \| "muted" \| "subtle" \| "danger" \| "ghost" \| "outline"` | `primary` | Visual style. |
|
|
49
|
+
| size | `"sm" \| "md" \| "lg" \| "xl" \| "icon" \| "icon-sm"` | `md` | `icon` / `icon-sm` render a square button — pass `aria-label`. |
|
|
50
|
+
| loading | `boolean` | `false` | Shows a spinner and blocks interaction, but keeps the button focusable so keyboard / screen-reader users don't lose their place. |
|
|
51
|
+
| startIcon | `ReactNode` | | Icon rendered before the label. |
|
|
52
|
+
| endIcon | `ReactNode` | | Icon rendered after the label. |
|
|
53
|
+
| fullWidth | `boolean` | `false` | Stretch to fill the container width. |
|
|
54
|
+
|
|
55
|
+
From Base UI:
|
|
56
|
+
|
|
57
|
+
| Prop | Type | Default | Description |
|
|
58
|
+
| --- | --- | --- | --- |
|
|
59
|
+
| focusableWhenDisabled | `boolean` | `false` | Whether the button should be focusable when disabled. |
|
|
60
|
+
| nativeButton | `boolean` | `true` | Whether the component renders a native `<button>` element when replacing it via the `render` prop. |
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Checkbox
|
|
2
|
+
|
|
3
|
+
> Checkbox with optional label and description; supports indeterminate.
|
|
4
|
+
|
|
5
|
+
`import { Checkbox } from '@gebeta/ui';` · built on Base UI · @gebeta/ui 0.3.0
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
- Use for choices submitted with a form or multi-select. For instant on/off settings use `Switch`.
|
|
10
|
+
- Pass `label` (clickable) or, without a visible label, `aria-label`.
|
|
11
|
+
- Controlled: `checked` + `onCheckedChange(checked: boolean)`. Uncontrolled: `defaultChecked`.
|
|
12
|
+
- `indeterminate` for a "select all" parent whose children are partly selected.
|
|
13
|
+
- `className` goes on the outer `<label>`.
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Checkbox } from '@gebeta/ui';
|
|
19
|
+
|
|
20
|
+
<Checkbox label="Remember me" name="remember" />
|
|
21
|
+
<Checkbox label="Express delivery" description="Within 2 hours in Addis Ababa" defaultChecked />
|
|
22
|
+
<Checkbox aria-label="Select row 1" />
|
|
23
|
+
<Checkbox label="All zones" indeterminate />
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Behaviour details (Base UI 1.9.0)
|
|
27
|
+
|
|
28
|
+
Keyboard, focus, ARIA, events and `data-*` state attributes come from Base UI. Its docs ship in the installed
|
|
29
|
+
`@base-ui/react` package (see "Base UI docs" in index.md to locate it):
|
|
30
|
+
|
|
31
|
+
- `@base-ui/react/docs/react/components/checkbox.md` (~25 KB)
|
|
32
|
+
|
|
33
|
+
These files are large. List headings first (`grep -n '^##' <file>`), then read only the section you need,
|
|
34
|
+
e.g. the `Root Data Attributes` table for styling states like `[data-checked]`.
|
|
35
|
+
|
|
36
|
+
## Props
|
|
37
|
+
|
|
38
|
+
All parts also accept `className` (string or `(state) => string`), `style`, `render` (swap the element) and the native HTML attributes of the rendered element.
|
|
39
|
+
|
|
40
|
+
### Checkbox
|
|
41
|
+
|
|
42
|
+
| Prop | Type | Default | Description |
|
|
43
|
+
| --- | --- | --- | --- |
|
|
44
|
+
| label | `ReactNode` | | Visible label. |
|
|
45
|
+
| description | `ReactNode` | | Secondary text under the label. |
|
|
46
|
+
|
|
47
|
+
From Base UI:
|
|
48
|
+
|
|
49
|
+
| Prop | Type | Default | Description |
|
|
50
|
+
| --- | --- | --- | --- |
|
|
51
|
+
| defaultChecked | `boolean` | `false` | Whether the checkbox is initially ticked. |
|
|
52
|
+
| form | `string` | | Identifies the form that owns the hidden input. |
|
|
53
|
+
| id | `string` | | The id of the input element. |
|
|
54
|
+
| value | `string` | | The checkbox's value. |
|
|
55
|
+
| name | `string` | `undefined` | Identifies the field when a form is submitted. |
|
|
56
|
+
| checked | `boolean` | `undefined` | Whether the checkbox is currently ticked. |
|
|
57
|
+
| disabled | `boolean` | `false` | Whether the component should ignore user interaction. |
|
|
58
|
+
| onCheckedChange | `((checked: boolean, eventDetails: { reason: "none"; event: Event; cancel: () => void; a…` | | Event handler called when the checkbox is ticked or unticked. |
|
|
59
|
+
| readOnly | `boolean` | `false` | Whether the user should be unable to tick or untick the checkbox. |
|
|
60
|
+
| required | `boolean` | `false` | Whether the user must tick the checkbox before submitting a form. |
|
|
61
|
+
| indeterminate | `boolean` | `false` | Whether the checkbox is in a mixed state: neither ticked, nor unticked. |
|
|
62
|
+
| inputRef | `Ref<HTMLInputElement>` | | A ref to access the hidden `<input>` element. |
|
|
63
|
+
| parent | `boolean` | `false` | Whether the checkbox controls a group of child checkboxes. |
|
|
64
|
+
| uncheckedValue | `string` | | The value submitted with the form when the checkbox is unchecked. |
|
|
65
|
+
| nativeButton | `boolean` | `false` | Whether the component renders a native `<button>` element when replacing it via the `render` prop. |
|