Select individual options or groups with checked, unchecked, and mixed states.
Default
Receive a monthly email about new features.
Sizes
Group and Form
Table Selection
| Report | Owner | |
|---|---|---|
| Weekly activity | Operations | |
| Quarterly review | Finance | |
| Workspace usage | Product |
Custom Rendering
States
Purpose
A checkbox lets people turn an option on or off. In a group, they can choose more than one option, and a parent checkbox can show when only some are selected.
Parts & Composition
Use Checkbox with a visible label for a single choice. For related choices, place labeled Checkbox parts inside CheckboxGroup and give each option a unique value. Use CheckboxIndicator inside a checkbox when you need to configure or replace its mark.
API & Props
| Part / Prop | Purpose |
|---|---|
Checkbox | Control (size: xs | sm | md | lg, checked: boolean | 'indeterminate', defaultChecked, onCheckedChange, disabled, readOnly, required, name, value, form, parent, controller, debug, render) — renders a default <CheckboxIndicator /> when children is omitted |
CheckboxIndicator | Inner check/mixed mark (keepMounted, animated default true, or custom children) |
CheckboxGroup | Multi-choice group (value, defaultValue, onValueChange, allValues, disabled, readOnly, required, name, form, controller, debug, render) |
size | xs (20px), sm (24px), md (28px), lg (32px) — defaults to md and sets box size and --checkbox-icon-size |
createCheckboxController(), createCheckboxGroupController() | Programmatic getChecked/setChecked/toggle/focus and getValue/setValue/focus |
Common props in detail
| Prop | Purpose |
|---|---|
checked / defaultChecked | Use a boolean or indeterminate for the mixed state. |
onCheckedChange | Receives the next checked state and SDK change details. |
CheckboxGroup.value / allValues | Track selected values separately from the full set of choices used by a parent checkbox. |
Use checked="indeterminate" for a controlled mixed checkbox. In CheckboxGroup, set parent on a select-all checkbox and pass allValues so the parent reflects checked, unchecked, or mixed state automatically. Checked children submit as repeated fields under the group's name (the parent bulk toggle submits no value).
Interaction states
| State | Behavior |
|---|---|
| Rest (unchecked) | Uses buttonSurfaces.secondary with border-ring/40. |
| Checked / Indeterminate | Switches to buttonSurfaces.primary (bg-primary text-primary-foreground) and animates CheckboxIndicator (stroke-dashoffset draw for check, horizontal dash for indeterminate). |
| Active / press | Pressing an interactive checkbox compresses it slightly (scale-95, motion-reduce:transition-none). |
| Focus | Keyboard focus applies focusRing (ring-3 ring-ring/30). |
| Invalid | aria-invalid="true" / data-invalid on Checkbox or parent CheckboxGroup (group/control) applies border-destructive and ring-3 ring-destructive/25. |
| Disabled / Read-only | data-disabled dims the checkbox (opacity-50, cursor-not-allowed); data-readonly keeps it focusable with cursor-default. |
Theming, Layout & Responsiveness
Uses shadcn semantic tokens (primary, primary-foreground, background, foreground, border, ring, destructive) via buttonSurfaces and focusRing, compatible with light, dark, and custom themes.
| Attribute / CSS Var | Meaning |
|---|---|
data-slot="checkbox" / checkbox-indicator / checkbox-group | Stable slot selectors on each part. |
data-checked / data-unchecked / data-indeterminate | Present on Checkbox and CheckboxIndicator. |
data-disabled / data-readonly / data-required | Propagated state attributes. |
data-size | Reflects xs | sm | md | lg. |
--checkbox-icon-size | Inner mark size (0.6875rem / 0.75rem / 0.875rem / 1.0625rem). |
Checkbox uses touch-manipulation and an invisible 44×44px @media(pointer:coarse) touch target so standalone checkboxes remain easy to tap on mobile.
Motion & Accessibility
Tab moves between checkboxes and Space toggles the focused checkbox. Pair standalone checkboxes with a <label> or Field + FieldLabel, and name CheckboxGroup with FieldLabel, aria-labelledby, or aria-label.
Guidance for Coding Agents
Install Checkbox using the command in the Install tab. Read this Info page and the linked UI SDK reference before implementation. Use Checkbox for a boolean or mixed selection and CheckboxGroup for related choices. Pair each box with a label. Keep single state on the checkbox or group state at the root, and preserve the built-in indicator unless the design calls for a custom mark.
Pass allValues to CheckboxGroup when using a <Checkbox parent> select-all toggle.
Start from the closest Preview → Usage example and use this page’s API table for component parts and options. For inherited props, callbacks, keyboard behavior, and rendering options, consult UI SDK Checkbox.
CLI installation
bunx --bun shadcn@latest add https://ui.devvarena.com/api/r/checkbox'use client';
import type {
CheckboxChangeOptions,
CheckboxCheckedChangeReason,
CheckboxController,
CheckboxGroupChangeOptions,
CheckboxGroupController,
CheckboxGroupOptions,
CheckboxGroupState,
CheckboxGroupValueChangeReason,
CheckboxIndicatorState,
CheckboxOptions,
CheckboxState,
CheckedState,
} from '@ui-sdk/core/checkbox';
import {
createCheckboxController,
createCheckboxGroupController,
Checkbox as SDKCheckbox,
CheckboxGroup as SDKCheckboxGroup,
CheckboxIndicator as SDKCheckboxIndicator,
} from '@ui-sdk/react/checkbox';
import { cva } from 'class-variance-authority';
import type { ComponentProps } from 'react';
import { buttonSurfaces } from '@/components/devvarena-ui/button';
import {
compactControlHeights,
focusRing,
partClass,
type StandardControlSize,
} from '@/lib/devvarena-ui';
import { cn } from '@/lib/utils';
function checkboxSurface(checked: boolean) {
return checked ? buttonSurfaces.primary : cn(buttonSurfaces.secondary, 'border-ring/40');
}
function CheckboxMark({ mixed, animated = true }: { mixed?: boolean; animated?: boolean }) {
if (mixed) return <span className="h-0.5 w-2/3 rounded-full bg-current" />;
return (
<svg aria-hidden="true" width="1em" height="1em" viewBox="0 0 24 24">
<path
fill="none"
stroke="currentColor"
strokeDasharray={24}
strokeDashoffset={0}
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2.9}
d="M5 11L11 17L21 7"
className={cn(
animated &&
'motion-safe:transition-[stroke-dashoffset] motion-safe:duration-300 motion-safe:group-data-unchecked/checkbox-indicator:[stroke-dashoffset:24] motion-safe:starting:[stroke-dashoffset:24]',
)}
/>
</svg>
);
}
const checkboxStyles = cva(
'relative inline-grid aspect-square shrink-0 cursor-pointer place-items-center rounded-sm border bg-clip-padding align-middle transition-[background-color,border-color,box-shadow,filter,scale] duration-150 [@media(pointer:coarse)]:after:absolute [@media(pointer:coarse)]:after:inset-1/2 [@media(pointer:coarse)]:after:min-h-11 [@media(pointer:coarse)]:after:min-w-11 [@media(pointer:coarse)]:after:-translate-1/2 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-readonly:cursor-default motion-safe:active:not-data-disabled:not-data-readonly:scale-95 motion-reduce:transition-none',
{
variants: {
size: {
xs: [compactControlHeights.xs, '[--checkbox-icon-size:0.8125rem]'],
sm: [compactControlHeights.sm, '[--checkbox-icon-size:0.9375rem]'],
md: [compactControlHeights.md, '[--checkbox-icon-size:1.0625rem]'],
lg: [compactControlHeights.lg, '[--checkbox-icon-size:1.25rem]'],
},
},
},
);
type CheckboxGroupProps<T extends string = string> = ComponentProps<typeof SDKCheckboxGroup<T>>;
function CheckboxGroup<T extends string = string>({ className, ...props }: CheckboxGroupProps<T>) {
return <SDKCheckboxGroup<T> {...props} className={partClass('group/control', className)} />;
}
type CheckboxProps = ComponentProps<typeof SDKCheckbox> & {
size?: StandardControlSize;
};
function Checkbox({ size = 'md', className, children, ...props }: CheckboxProps) {
const hasRender = props.render !== undefined;
return (
<SDKCheckbox
{...props}
data-size={size}
className={partClass(
!hasRender && checkboxStyles({ size }),
!hasRender && focusRing,
hasRender
? undefined
: (state: CheckboxState) => checkboxSurface(state.checked || state.indeterminate),
className,
)}
>
{children === undefined && !hasRender ? defaultIndicator : children}
</SDKCheckbox>
);
}
type CheckboxIndicatorProps = ComponentProps<typeof SDKCheckboxIndicator> & {
animated?: boolean;
};
function CheckboxIndicator({
animated = true,
children,
className,
...props
}: CheckboxIndicatorProps) {
return (
<SDKCheckboxIndicator
aria-hidden="true"
{...props}
className={partClass(
'group/checkbox-indicator pointer-events-none grid size-[var(--checkbox-icon-size,1.0625rem)] place-items-center data-unchecked:opacity-0 [&>svg]:size-full',
animated &&
'transition-[opacity,scale] duration-150 data-starting-style:scale-75 data-starting-style:opacity-0 data-ending-style:scale-75 data-ending-style:opacity-0 motion-reduce:transition-none',
className,
)}
>
{(state) => {
if (typeof children === 'function') return children(state);
if (children != null) return children;
return <CheckboxMark mixed={state.indeterminate} animated={animated} />;
}}
</SDKCheckboxIndicator>
);
}
const defaultIndicator = <CheckboxIndicator />;
export {
Checkbox,
type CheckboxChangeOptions,
type CheckboxCheckedChangeReason,
type CheckboxController,
CheckboxGroup,
type CheckboxGroupChangeOptions,
type CheckboxGroupController,
type CheckboxGroupOptions,
type CheckboxGroupState,
type CheckboxGroupValueChangeReason,
CheckboxIndicator,
type CheckboxIndicatorState,
CheckboxMark,
type CheckboxOptions,
type CheckboxState,
type CheckedState,
checkboxSurface,
createCheckboxController,
createCheckboxGroupController,
};
import type { ButtonOptions } from '@ui-sdk/core/button';
import { Button as ButtonPrimitive } from '@ui-sdk/react/button';
import { cva, type VariantProps } from 'class-variance-authority';
import { Loader2 } from 'lucide-react';
import type { ComponentProps, ReactNode } from 'react';
import { controlHeights, controlTextSizes, focusRing } from '@/lib/devvarena-ui';
import { cn } from '@/lib/utils';
/*
* Clean tactile button surfaces with a subtle top highlight, contact shadow,
* and 2% press scale using pure Tailwind/theme tokens.
*/
const flatPress = 'motion-safe:not-data-disabled:not-data-pending:active:scale-[0.985]';
const activeInsetShadow =
'active:shadow-[inset_0_1px_3px_rgb(0_0_0/0.12),0_1px_2px_rgb(0_0_0/0.06)] dark:active:shadow-[inset_0_1px_3px_rgb(0_0_0/0.18),0_1px_2px_rgb(0_0_0/0.1)]';
const tactileFilled =
'bg-[linear-gradient(180deg,rgb(255_255_255/0.16),rgb(255_255_255/0)_75%)] shadow-[inset_0_1.5px_0_rgb(255_255_255/0.22),inset_0_-1px_0_rgb(0_0_0/0.12),0_1px_3px_0_rgb(0_0_0/0.1),0_1px_2px_-1px_rgb(0_0_0/0.1)] active:shadow-[inset_0_1px_3px_rgb(0_0_0/0.18),0_1px_2px_rgb(0_0_0/0.1)]';
const tactileNeutral = `bg-[linear-gradient(180deg,rgb(255_255_255/0.35),transparent_48%,rgb(0_0_0/0.025)_100%)] shadow-[inset_0_1px_0_rgb(255_255_255/0.65),inset_0_-1px_0_rgb(0_0_0/0.06),0_1px_3px_0_rgb(0_0_0/0.1),0_1px_2px_-1px_rgb(0_0_0/0.1)] dark:bg-[linear-gradient(180deg,rgb(255_255_255/0.06),transparent_48%,rgb(0_0_0/0.12)_100%)] dark:shadow-[inset_0_1px_0_rgb(255_255_255/0.1),inset_0_-1px_0_rgb(0_0_0/0.12),0_1px_3px_0_rgb(0_0_0/0.1),0_1px_2px_-1px_rgb(0_0_0/0.1)] ${activeInsetShadow}`;
/** Surface map for button variants, shared with Toggle, Tabs, Radio, Checkbox, and Switch. */
const buttonSurfaces = {
primary: `border-[color-mix(in_oklch,var(--primary),black_8%)] bg-primary text-primary-foreground ${tactileFilled} ${flatPress}`,
secondary: ` bg-popover text-popover-foreground border-[color-mix(in_oklch,var(--muted),black_5%)] ${tactileNeutral} ${flatPress}`,
outline: `border-input bg-accent/10 text-foreground shadow-sm hover:text-accent-foreground ${activeInsetShadow} ${flatPress}`,
ghost: `border-transparent text-foreground hover:bg-muted ${activeInsetShadow} ${flatPress}`,
destructive: `border-[color-mix(in_oklch,var(--destructive),black_8%)] bg-destructive text-[color:var(--destructive-foreground,white)] ${tactileFilled} ${flatPress}`,
tertiary: `border-transparent bg-accent text-accent-foreground ${activeInsetShadow} ${flatPress}`,
'destructive-soft': `border-transparent bg-destructive/10 text-destructive dark:bg-destructive/20 ${activeInsetShadow} ${flatPress}`,
link: 'border-transparent text-primary underline-offset-4 hover:underline',
} as const;
type ButtonVariant = keyof typeof buttonSurfaces;
const buttonBase = cva(
[
// layout
'group/button relative isolate inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-lg border text-sm font-medium',
// interaction
'cursor-pointer select-none touch-manipulation',
'transition-[background-color,border-color,box-shadow,translate,scale,filter] duration-150 ease-out motion-reduce:transition-none',
focusRing,
// 44px touch target on coarse pointers without changing the visual size
'[@media(pointer:coarse)]:after:absolute [@media(pointer:coarse)]:after:inset-1/2 [@media(pointer:coarse)]:after:min-h-11 [@media(pointer:coarse)]:after:min-w-11 [@media(pointer:coarse)]:after:-translate-1/2',
// states
'disabled:cursor-not-allowed aria-disabled:opacity-50 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-pending:cursor-wait',
// icons
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-(--icon-size,1rem) [&>span:has(>svg):not([class*='size-'])]:size-(--icon-size,1rem)",
],
{
variants: {
size: {
md: `${controlHeights.md} ${controlTextSizes.md} gap-2 px-4 [--icon-size:1.2rem]`,
xs: `${controlHeights.xs} ${controlTextSizes.xs} gap-1 px-2.5 [--icon-size:0.875rem]`,
sm: `${controlHeights.sm} ${controlTextSizes.sm} gap-1.5 px-3 [--icon-size:1rem]`,
lg: `${controlHeights.lg} ${controlTextSizes.lg} gap-2 px-6 [--icon-size:1.25rem]`,
icon: `${controlHeights.md} aspect-square [--icon-size:1.2rem]`,
'icon-xs': `${controlHeights.xs} aspect-square [--icon-size:0.875rem]`,
'icon-sm': `${controlHeights.sm} aspect-square [--icon-size:1rem]`,
'icon-lg': `${controlHeights.lg} aspect-square [--icon-size:1.25rem]`,
},
},
defaultVariants: { size: 'md' },
},
);
type ButtonVariantProps = VariantProps<typeof buttonBase> & {
variant?: ButtonVariant;
};
function buttonVariants({
variant = 'primary',
size,
className,
}: ButtonVariantProps & { className?: string } = {}) {
return cn(buttonBase({ size }), buttonSurfaces[variant], className);
}
type ButtonProps = Omit<
ComponentProps<typeof ButtonPrimitive>,
keyof ButtonOptions | 'className' | 'children'
> &
ButtonOptions &
ButtonVariantProps & {
children?: ReactNode;
className?: string;
/** Prevent repeated activation and display an inline spinner without replacing the label. */
loading?: boolean;
};
const spinner = (
<Loader2
aria-hidden="true"
data-slot="spinner"
className="hidden size-(--icon-size,1rem) animate-spin in-data-pending:inline-block in-data-loading:inline-block motion-reduce:animate-none"
/>
);
function Button({
className,
variant = 'primary',
size = 'md',
loading = false,
disabled,
children,
'aria-busy': ariaBusy,
...props
}: ButtonProps) {
return (
<ButtonPrimitive
{...props}
className={buttonVariants({ variant, size, className })}
data-size={size}
data-variant={variant}
data-loading={loading || undefined}
disabled={disabled || loading}
aria-busy={loading || ariaBusy}
>
{spinner}
{children}
</ButtonPrimitive>
);
}
export { Button, type ButtonProps, type ButtonVariant, buttonSurfaces, buttonVariants };
import { cn } from '@/lib/utils';
type ClassValue = string | false | null | undefined;
type PartClassValue<State> = ClassValue | ((state: State) => ClassValue);
/** Composes static class names and UI-SDK state class functions into a single `className` prop. */
export function partClass<State>(...parts: PartClassValue<State>[]) {
if (parts.some((part) => typeof part === 'function')) {
return (state: State) =>
cn(...parts.map((part) => (typeof part === 'function' ? part(state) : part)));
}
return cn(...(parts as ClassValue[]));
}
export const surfacePadding = 'p-1 [--surface-padding:1.5rem] [--concentric-inset:0.25rem]';
export const surfaceRegionInset = 'p-[calc(var(--surface-padding,1rem)-0.5rem)]';
export const surfaceHeaderRadius = 'rounded-t-[max(0px,calc(var(--radius-lg,0.5rem)-0.25rem))]';
export const surfaceFooterRadius = 'rounded-b-[max(0px,calc(var(--radius-lg,0.5rem)-0.25rem))]';
/** Concentric inner radius (`outer - inset`); set `[--concentric-inset:0.125rem]` on `p-0.5` rails (defaults to `0.25rem` for `p-1`). */
export const concentricRadius =
'rounded-[max(0px,calc(var(--radius-lg,0.5rem)-var(--concentric-inset,0.25rem)))]';
export const surfaceBodyPadding =
'py-[max(0px,calc(var(--surface-padding,1rem)-1rem))] has-[>[data-slot=list]:not([data-variant=plain])]:p-0 has-[>[data-slot=list-items-container]]:p-0';
export type StandardControlSize = 'xs' | 'sm' | 'md' | 'lg';
/** Standard control heights (`28px / 32px / 40px / 48px`) for buttons, inputs, selects, tabs, and sliders. */
export const controlHeights = {
xs: 'h-7',
sm: 'h-8',
md: 'h-10',
lg: 'h-12',
} as const satisfies Record<StandardControlSize, string>;
/** Standard minimum control heights (`28px / 32px / 40px / 48px`) for expandable controls and menu items. */
export const controlMinHeights = {
xs: 'min-h-7',
sm: 'min-h-8',
md: 'min-h-10',
lg: 'min-h-12',
} as const satisfies Record<StandardControlSize, string>;
/** Standard control text sizes (`xs / xs / sm / base`) paired with `StandardControlSize`. */
export const controlTextSizes = {
xs: 'text-xs',
sm: 'text-xs',
md: 'text-sm',
lg: 'text-base',
} as const satisfies Record<StandardControlSize, string>;
/** Compact control heights (`1.25rem / 1.3rem / 1.625rem / 1.75rem`), one step smaller than standard, for switches and compact controls. */
export const compactControlHeights = {
xs: 'h-[1.3rem]',
sm: 'h-[1.4rem]',
md: 'h-[1.5rem]',
lg: 'h-[1.6rem]',
} as const satisfies Record<StandardControlSize, string>;
/** Compact minimum control heights (`1rem / 1.25rem / 1.5rem / 1.75rem`) for badges and tooltips. */
export const compactControlMinHeights = {
xs: 'min-h-[1.3rem]',
sm: 'min-h-[1.4rem]',
md: 'min-h-[1.5rem]',
lg: 'min-h-[1.6rem]',
} as const satisfies Record<StandardControlSize, string>;
/** Universal keyboard focus + invalid ring/border styles shared across controls. */
export const focusRing =
'touch-manipulation outline-none focus-visible:border-ring/30 transition-ring focus-visible:ring-3 focus-visible:ring-ring/15 focus-visible:brightness-[0.97] dark:focus-visible:brightness-[1.15] has-[:focus-visible]:border-ring/30 has-[:focus-visible]:ring-3 has-[:focus-visible]:ring-ring/15 has-[:focus-visible]:brightness-[0.97] dark:has-[:focus-visible]:brightness-[1.15] data-active:border-ring/30 data-active:ring-3 data-active:ring-ring/15 data-active:brightness-[0.97] dark:data-active:brightness-[1.15] data-open:border-ring/30 data-open:ring-3 data-open:ring-ring/15 data-open:brightness-[0.97] dark:data-open:brightness-[1.15] data-disabled:cursor-not-allowed data-disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/25 data-invalid:border-destructive data-invalid:ring-3 data-invalid:ring-destructive/25 has-[[data-invalid]]:border-destructive has-[[data-invalid]]:ring-3 has-[[data-invalid]]:ring-destructive/25 group-aria-invalid/control:border-destructive group-aria-invalid/control:ring-3 group-aria-invalid/control:ring-destructive/25 group-data-invalid/control:border-destructive group-data-invalid/control:ring-3 group-data-invalid/control:ring-destructive/25 group-has-[input[aria-invalid=true]]/control:border-destructive group-has-[input[aria-invalid=true]]/control:ring-3 group-has-[input[aria-invalid=true]]/control:ring-destructive/25 hover:brightness-[0.97] dark:hover:brightness-[1.15]';
/** Shared sliding highlight indicator base (pointer-safe, concentric inner radius inside rounded-lg containers, 200ms transition). */
export const slidingHighlight =
'pointer-events-none -z-10 rounded-[max(0px,calc(var(--radius-lg,0.5rem)-var(--concentric-inset,0.25rem)))] bg-primary/10 [clip-path:inset(0px_round_max(0px,calc(var(--radius-lg,0.5rem)-var(--concentric-inset,0.25rem))))] transition-[transform,width,height,opacity] duration-200 ease-out motion-reduce:transition-none';
export const textFieldSurfaces = {
filled: 'border-input bg-card text-card-foreground',
outline: 'border-input bg-transparent text-foreground dark:bg-transparent',
ghost: 'border-transparent bg-muted text-foreground shadow-none',
underline:
'rounded-none border-0 border-b-2 border-input bg-transparent px-0 text-foreground shadow-none focus-visible:border-ring focus-visible:ring-0 aria-invalid:ring-0 data-invalid:ring-0 dark:bg-transparent',
} as const;
export const textFieldUnderlineMotion =
'border-transparent! bg-origin-border bg-bottom bg-no-repeat [--underline-color:var(--primary)] [background-image:linear-gradient(var(--underline-color),var(--underline-color)),linear-gradient(var(--input),var(--input))] [background-size:0%_2px,100%_2px] focus:[background-size:100%_2px,100%_2px] aria-invalid:[--underline-color:var(--destructive)] data-invalid:[--underline-color:var(--destructive)] transition-[border-color,background-color,box-shadow,filter,background-size] duration-200 motion-reduce:transition-none';
/** Generic balanced icon & floating-label layout tokens shared across all text-field sizes. */
export const textFieldLayout = {
icon: 'size-4',
iconStart: 'start-3',
iconEnd: 'end-3',
padStart: 'ps-9',
padEnd: 'pe-9',
underlinePadStart: 'ps-7',
underlinePadEnd: 'pe-7',
floatingStart: 'start-2.5',
floatingWithIcon: 'start-8',
floatingUnderlineIcon: 'start-6',
} as const;
export const textFieldLabelSegmenter = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
/** Clamps per-grapheme wave delay (ms) so total staggering stays within 300ms. */
export function clampWaveDelay(waveDelay: number, count: number): number {
return Math.max(
0,
Math.min(Number.isFinite(waveDelay) ? waveDelay : 24, 80, 300 / Math.max(1, count - 1)),
);
}
/** Shared scale/color transition for floating labels inside a `group/field` wrapper. */
export const textFieldLabelMotion =
'inline-block origin-left backdrop-blur-xs transition-[scale,color] duration-200 ease-out group-has-[input:focus]/field:scale-85 group-has-[input:not(:placeholder-shown)]/field:scale-85 rtl:origin-right motion-reduce:transition-none';
/** Resolves start/end padding for a text field when a leading or trailing icon is present. */
export function getTextFieldIconPadding(iconPosition: 'start' | 'end', underline: boolean): string {
if (iconPosition === 'start') {
return underline ? textFieldLayout.underlinePadStart : textFieldLayout.padStart;
}
return underline ? textFieldLayout.underlinePadEnd : textFieldLayout.padEnd;
}
/** Shared per-grapheme ripple transition for wave labels inside a `group/field` wrapper. */
export const textFieldWaveMotion =
'inline-block origin-left backdrop-blur-xs transition-[translate,scale,color] duration-200 ease-out group-has-[input:focus]/field:-translate-y-5 group-has-[input:focus]/field:scale-85 group-has-[input:focus]/field:text-primary group-has-[input:not(:placeholder-shown)]/field:-translate-y-5 group-has-[input:not(:placeholder-shown)]/field:scale-85 group-has-[input[aria-invalid=true]]/field:text-destructive rtl:origin-right motion-reduce:transition-none';