Label: add support for kobalte select

This commit is contained in:
Johannes Kirschbauer
2025-08-05 13:34:40 +02:00
parent de81a5d810
commit 90ef55f040
2 changed files with 10 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
div.form-label { div.form-label {
@apply flex flex-col gap-1 w-full; @apply flex flex-col gap-1 w-full;
& > span,
& > label, & > label,
& > div { & > div {
@apply w-full; @apply w-full;
@@ -8,12 +9,14 @@ div.form-label {
@apply leading-none; @apply leading-none;
} }
& > span,
& > label { & > label {
@apply flex items-center gap-1; @apply flex items-center gap-1;
} }
& > span[data-required]:not(span[data-readonly]),
& > label[data-required]:not(label[data-readonly]) { & > label[data-required]:not(label[data-readonly]) {
span.typography::after { .typography::after {
@apply fg-def-4 ml-1; @apply fg-def-4 ml-1;
content: "*"; content: "*";

View File

@@ -5,6 +5,7 @@ import Icon from "@/src/components/Icon/Icon";
import { TextField } from "@kobalte/core/text-field"; import { TextField } from "@kobalte/core/text-field";
import { Checkbox } from "@kobalte/core/checkbox"; import { Checkbox } from "@kobalte/core/checkbox";
import { Combobox } from "@kobalte/core/combobox"; import { Combobox } from "@kobalte/core/combobox";
import { Select } from "@kobalte/core/select";
import "./Label.css"; import "./Label.css";
export type Size = "default" | "s"; export type Size = "default" | "s";
@@ -12,11 +13,14 @@ export type Size = "default" | "s";
export type LabelComponent = export type LabelComponent =
| typeof TextField.Label | typeof TextField.Label
| typeof Checkbox.Label | typeof Checkbox.Label
| typeof Combobox.Label; | typeof Combobox.Label
| typeof Select.Label;
export type DescriptionComponent = export type DescriptionComponent =
| typeof TextField.Description | typeof TextField.Description
| typeof Checkbox.Description | typeof Checkbox.Description
| typeof Combobox.Description; | typeof Combobox.Description
| typeof Select.Description;
export interface LabelProps { export interface LabelProps {
labelComponent: LabelComponent; labelComponent: LabelComponent;