npm install @idyeah/diya
GitHub
Appearance
Color scheme

Field

Get code

Three steps. The first two happen once per app.

Step 1: Install

Terminal, in your app’s folder
npm install @idyeah/diya

Once per app. Every component and pattern is in this one package.

Working in Claude Code or Cursor? Connect your editor once and it fetches this for you.

No app yet? npm create diya@latest sets up Next.js or Vite with the styles and provider already in place. Then skip to step 3.

Step 2: Add the styles and provider

Once, at your app’s root: app/layout.tsx in Next.js, src/main.tsx in Vite. DIYA Sans comes with it.

Root layout or entry
import '@idyeah/diya/styles.css'
import { DiyaProvider } from '@idyeah/diya'

<DiyaProvider theme="dark">
  {children}
</DiyaProvider>

theme="dark" matches the catalog as you’re viewing it. theme="system" follows each visitor’s light or dark setting instead.

Get theme

Your brand as one CSS file and a few props.

Brand
AaAaNeutral (DIYA default)
Font
DIYA Sans
Corners · Elevation
Soft · Soft
Control height · Fields
Default · Auto
Glass
Off
Motion
Match device
Status colors
DIYA defaults

Step 1: Save the theme file

diya-theme.css · 6 lines
/* diya-theme.css, made in the DIYA catalog.
   Import it after '@idyeah/diya/styles.css'. Public tokens only.
   Brand: Neutral (DIYA default). */

/* No color, corner or elevation changes: DIYA's defaults apply. */

Public tokens only: the names DIYA promises not to rename in 1.x.

Step 2: Import it after DIYA’s styles

Root layout or entry
import '@idyeah/diya/styles.css'
import './diya-theme.css'

Order matters. The theme goes second so it wins.

Size
Options
State

In your time zone.

Using Field

A label, helper text and error around a control DIYA doesn't make: your own input, a native one DIYA doesn't wrap, or a third-party or hosted control.

A Markdown brief for Claude, Cursor or v0: install, setup, props and a complete example.

When to use

For a control DIYA doesn’t make: your own input, a native one DIYA doesn’t wrap (time, color), or a third-party or hosted control. Field gives it the label, help and error every DIYA field has.

DIYA makes the control? Use its own label, helperText and error. A payment provider’s card field? Field with framed draws the field box around it.

Accessibility

The label points at the control, the help or error is linked with aria-describedby, and an error sets aria-invalid. A hosted iframe is named with aria-labelledby, a label click moves focus into it, and its error is spoken as focus arrives, since ids can’t reach inside a frame.

Props

import { Field } from '@idyeah/diya'Stable since 1.2.0

childrenRequiredReactElement<any, string | React.JSXElementConstructor<any>> | ((control: FieldControlProps) => ReactNode)

One control element, which gets the ids and states merged in; or a function that receives them, for a control that takes them somewhere else.

labelRequiredstring

Visible label above the control; also its accessible name. Hide it with hideLabel.

disabledboolean

Dims the field and passes disabled to the control; put the reason in helperText.

errorstring

Visible error message below the control; marks the field invalid while set.

framedboolean

Draws DIYA's field box (fill, edge, corner, height and focus ring) around a control that has none, such as a payment provider's card iframe or a native time input. A label click focuses the iframe; if your provider needs its own focus() to reach its input (Stripe, Braintree), call it from the label: onClick={(event) => { if ((event.target as Element).closest('label')) card.focus() }}. Defaults to false.

Default false

helperTextstring

Visible hint below the control, announced with it; error replaces it while set.

hideLabelboolean

Hides the label visually but keeps it as the control's accessible name.

Default false

idstring

The control's id, for a function child or a child without its own id; a child's own id wins. Defaults to a generated one.

requiredboolean

Tells assistive tech the control is required (aria-required) and draws nothing. Mark the few optional fields with "(optional)" in their label instead.

size"small" | "medium" | "large"

With framed, the frame's height and text size; defaults to 'medium'.

Default 'medium'

Also takes every native <div> attribute, such as id, aria-* or data-*.