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

Input

すべての native input 属性を引き渡しながら、ニューモーフィックな inset サーフェス、file input、disabled 状態、aria-invalid 状態を一貫してスタイリングします。

@neumorphism-ui/input
Registry JSON

プレビュー

インストール

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

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

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

使い方

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

Import

Input の import コード
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"

Example

Input の使用コード
<div className="grid gap-2">
  <Label htmlFor="email">メールアドレス</Label>
  <Input
    id="email"
    name="email"
    type="email"
    placeholder="you@example.com"
    autoComplete="email"
  />
</div>

API リファレンス

コンポーネントプロパティ型デフォルト説明
InputtypeReact.HTMLInputTypeAttribute"text" (browser default)email、password、file などの native input type です。
Inputvalue / defaultValuestring | number—制御された値、または非制御時の初期値です。
Inputplaceholderstring—期待する値の形式を伝えるための短い例です。
Inputdisabled / required / readOnlybooleanfalsenative input の制約を設定します。
Inputaria-invalidboolean | string—エラー用の border と focus ring を有効にします。

アクセシビリティ

  • 01

    Label の htmlFor と Input の id を関連付けるか、aria-label を指定してください。

  • 02

    placeholder は Label の代わりにはならず、期待する形式の例だけを示すために使用します。

  • 03

    エラー時は aria-invalid を設定し、エラーメッセージの id を aria-describedby で関連付けてください。