# Input group

Prefixes, suffixes, units and actions for a labelled native input.

Access: pro. Category: Forms. Kind: primitive.

## When to use

- Use it when a product interface needs prefixes, suffixes, units and actions for a labelled native input.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose form-field instead when a labeled email field with validation and help text is the actual interface need, rather than input group.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Input group

```sh
npx shadcn@latest add @tidal-pro/input-group
```

Stylesheets: `components/ui/tidal.css`, `components/ui/input-group.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/input-group.css";
import{TidalInputGroup}from"./components/ui/input-group";
export default()=><div className="tidal-scope"><TidalInputGroup label={"Demo"}/></div>;
```

## Structured props

- `TidalInputGroup.label: ReactNode`: Required label value accepted by this exported component.
- `TidalInputGroup.actions?: ReadonlyArray<TidalInputGroupAction> | undefined` (default []): Optional actions value accepted by this exported component.
- `TidalInputGroup.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalInputGroup.disabled?: boolean | undefined` (default false): Optional disabled value accepted by this exported component.
- `TidalInputGroup.error?: ReactNode`: Optional error value accepted by this exported component.
- `TidalInputGroup.prefix?: ReactNode`: Optional prefix value accepted by this exported component.
- `TidalInputGroup.prefixLabel?: string | undefined`: Optional prefix label value accepted by this exported component.
- `TidalInputGroup.readOnly?: boolean | undefined` (default false): Optional read only value accepted by this exported component.
- `TidalInputGroup.rootClassName?: string | undefined` (default ""): Optional root class name value accepted by this exported component.
- `TidalInputGroup.rootProps?: Omit<HTMLAttributes<HTMLDivElement>, "className" | "children"> | undefined`: Optional root props value accepted by this exported component.
- `TidalInputGroup.suffix?: ReactNode`: Optional suffix value accepted by this exported component.
- `TidalInputGroup.suffixLabel?: string | undefined`: Optional suffix label value accepted by this exported component.
- `TidalInputGroup.unit?: ReactNode`: Optional unit value accepted by this exported component.
- `TidalInputGroup.unitLabel?: string | undefined`: Optional unit label value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/input-group.tsx) | [Manifest](https://tidalui.com/examples/input-group.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useId, useRef, useState, type FormEvent } from "react";

import { TidalInputGroup, type TidalInputGroupAction } from "./components/ui/input-group";

import "./components/ui/input-group.css";



const tidalExampleStyles = ".tidal-scope .input-group-demo {\n  width: min(100%, 520px);\n  min-width: 0;\n  color: var(--t-ink);\n}\n\n.tidal-scope .input-group-demo-form {\n  display: grid;\n  gap: 28px;\n}\n\n.tidal-scope .input-group-demo-footer {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 14px;\n  min-width: 0;\n  padding-top: 18px;\n  border-top: 1px solid var(--t-border);\n}\n\n.tidal-scope .input-group-demo-footer p {\n  min-width: 0;\n  margin: 0;\n  color: var(--t-muted);\n  font-size: 11px;\n  line-height: 1.55;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .input-group-demo-footer > button {\n  min-width: 112px;\n  min-height: 44px;\n  padding: 9px 14px;\n  border: 1px solid var(--t-border);\n  border-radius: var(--t-radius-control);\n  background: var(--t-surface);\n  color: var(--t-ink);\n  font: inherit;\n  font-size: 12px;\n  font-weight: 630;\n  cursor: pointer;\n  transition:\n    background-color 140ms,\n    color 140ms,\n    transform 140ms var(--t-ease-out);\n}\n\n.tidal-scope .input-group-demo-footer > button:hover {\n  background: var(--t-ink);\n  color: var(--t-surface);\n}\n\n.tidal-scope .input-group-demo-footer > button:active {\n  transform: scale(0.98);\n}\n\n.tidal-scope .input-group-demo-footer > button:focus-visible {\n  outline: 2px solid var(--t-accent);\n  outline-offset: 3px;\n}\n\n@container preview-stage (max-width: 420px) {\n  .tidal-scope .input-group-demo-footer {\n    align-items: stretch;\n    flex-direction: column;\n  }\n\n  .tidal-scope .input-group-demo-footer > button {\n    width: 100%;\n  }\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .tidal-scope .input-group-demo-footer > button {\n    transition: none;\n  }\n\n  .tidal-scope .input-group-demo-footer > button:active {\n    transform: none;\n  }\n}";

export function InputGroupDemo() {
  const generatedId = useId().replace(/:/g, "");
  const budgetId = `${generatedId}-budget`;
  const pathId = `${generatedId}-path`;
  const budgetRef = useRef<HTMLInputElement>(null);
  const [budget, setBudget] = useState("48");
  const [path, setPath] = useState("launch-brief");
  const [error, setError] = useState("");
  const [status, setStatus] = useState("Edit either local sample field.");

  const budgetActions: readonly TidalInputGroupAction[] = [
    {
      actionId: "apply-budget",
      label: "Apply",
      type: "submit",
    },
  ];
  const pathActions: readonly TidalInputGroupAction[] = [
    {
      actionId: "set-path-sample",
      label: "Use sample",
      onClick: () => {
        setPath("workspace-notes");
        setStatus("The sample workspace path changed locally.");
      },
    },
  ];

  function submitBudget(event: FormEvent<HTMLFormElement>) {
    event.preventDefault();
    const node = budgetRef.current;
    if (!node?.checkValidity() || Number(budget) <= 0) {
      setError("Enter an amount greater than zero.");
      node?.focus({ preventScroll: true });
      return;
    }
    setError("");
    setStatus(`Local budget preview: $${budget} USD per month.`);
  }

  return (
    <section className="input-group-demo" aria-label="Workspace input groups">
      <form
        className="input-group-demo-form"
        onSubmit={submitBudget}
        onReset={() => {
          setBudget("48");
          setPath("launch-brief");
          setError("");
          setStatus("The local sample was reset.");
        }}
      >
        <TidalInputGroup
          ref={budgetRef}
          id={budgetId}
          label="Monthly workspace budget"
          name="budget"
          type="number"
          inputMode="decimal"
          min="1"
          step="1"
          required
          value={budget}
          onChange={(event) => {
            setBudget(event.currentTarget.value);
            setError("");
          }}
          prefix="$"
          prefixLabel="US dollars"
          unit="USD / month"
          unitLabel="US dollars per month"
          actions={budgetActions}
          description="This preview validates and formats the value locally."
          error={error || undefined}
        />

        <TidalInputGroup
          id={pathId}
          label="Workspace path"
          name="workspace-path"
          value={path}
          onChange={(event) => {
            setPath(event.currentTarget.value);
            setStatus("The sample path has unsaved local changes.");
          }}
          prefix="northstar /"
          prefixLabel="Northstar workspace prefix"
          suffix=".preview"
          suffixLabel="Preview suffix"
          actions={pathActions}
          autoComplete="off"
          spellCheck={false}
        />

        <div className="input-group-demo-footer">
          <p role="status">{status}</p>
          <button type="reset">Reset sample</button>
        </div>
      </form>
    </section>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <InputGroupDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Extends native input attributes except component-owned children, disabled/readOnly and their ARIA mirrors; the forwarded ref targets the native input. Required label plus optional description/error ReactNode values receive linked IDs without dropping numeric zero. Optional prefix, suffix and unit ReactNode slots support accessible labels; units are always included in aria-describedby. Typed actions require stable actionId keys, default to native type=button, accept start/end placement, preserve native button attributes/DOM id/refs and explicit aria-disabled=false, and normalize aria-disabled=true into actual disabled behavior. Component disabled disables the input and every action; readOnly keeps the native input read-only while leaving consumer-owned actions available. Optional rootProps/rootClassName compose native div attributes. Consumers own values, validation, form submission, action behavior, requests, storage and focus after accepted actions.
