フォームと選択@neumorphism-ui/input-group

Input Group

InputGroupInput または InputGroupTextarea に、前後の addon、補足テキスト、button を組み合わせます。root の focus-within 状態により、group 全体に一貫した focus 表現を適用します。

@neumorphism-ui/input-group
Registry JSON

プレビュー

https://

インストール

インストール: input-groupnpx shadcn@latest add @neumorphism-ui/input-group

CLI が npm 依存関係、base token、utils、コンポーネントソースを順番に処理します。

この Registry を初めて使う場合は、先に namespace の設定 を完了してください。

使い方

使い方: インストールnpx shadcn@latest add @neumorphism-ui/input-group @neumorphism-ui/label

Import

Input Group の import コード
import {
  InputGroup,
  InputGroupAddon,
  InputGroupButton,
  InputGroupInput,
  InputGroupText,
} from "@/components/ui/input-group"
import { Label } from "@/components/ui/label"

Example

Input Group の使用コード
<div className="grid gap-2">
  <Label htmlFor="workspace">ワークスペース</Label>
  <InputGroup>
    <InputGroupAddon aria-hidden="true"><svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"><circle cx="11" cy="11" r="7" /><path d="m20 20-4-4" /></svg></InputGroupAddon>
    <InputGroupInput id="workspace" defaultValue="soft-interface" />
    <InputGroupButton type="button">検索</InputGroupButton>
  </InputGroup>
</div>

API リファレンス

コンポーネントプロパティ型デフォルト説明
InputGroupchildren必須React.ReactNode—control、addon、text、button を順番に配置します。
InputGrouparia-label / aria-labelledbystring—必要に応じて role=group 全体にアクセシブルな名前を指定します。
InputGroupInputnative input propsReact.ComponentProps<"input">—id、name、type、value、onChange などの native 属性です。
InputGroupTextareanative textarea propsReact.ComponentProps<"textarea">—複数行 control の native 属性です。
InputGroupButtontype"button" | "submit" | "reset""button"group action に使用する button type です。

アクセシビリティ

  • 01

    root の role=group は input 自体の名前にはならないため、control を Label と直接関連付けてください。

  • 02

    装飾だけの addon は aria-hidden=true で隠し、意味のある単位や prefix は支援技術から利用できる状態にしてください。

  • 03

    アイコンのみの InputGroupButton には aria-label を指定してください。