Input
すべての native input 属性を引き渡しながら、ニューモーフィックな inset サーフェス、file input、disabled 状態、aria-invalid 状態を一貫してスタイリングします。
@neumorphism-ui/inputプレビュー
インストール
インストール: input
npx shadcn@latest add @neumorphism-ui/inputCLI が npm 依存関係、base token、utils、コンポーネントソースを順番に処理します。
この Registry を初めて使う場合は、先に namespace の設定 を完了してください。
使い方
使い方: インストール
npx shadcn@latest add @neumorphism-ui/input @neumorphism-ui/labelImport
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 リファレンス
| コンポーネント | プロパティ | 型 | デフォルト | 説明 |
|---|---|---|---|---|
Input | type | React.HTMLInputTypeAttribute | "text" (browser default) | email、password、file などの native input type です。 |
Input | value / defaultValue | string | number | — | 制御された値、または非制御時の初期値です。 |
Input | placeholder | string | — | 期待する値の形式を伝えるための短い例です。 |
Input | disabled / required / readOnly | boolean | false | native input の制約を設定します。 |
Input | aria-invalid | boolean | string | — | エラー用の border と focus ring を有効にします。 |
アクセシビリティ
- 01
Label の htmlFor と Input の id を関連付けるか、aria-label を指定してください。
- 02
placeholder は Label の代わりにはならず、期待する形式の例だけを示すために使用します。
- 03
エラー時は aria-invalid を設定し、エラーメッセージの id を aria-describedby で関連付けてください。