コンテンツにスキップ
Page

Input

エラーと成功の状態を持つ 1 行の入力です。

import { Input } from "@pelagornis/page/components";

上のプレビューはこのファイルを描画したものです。src/components/ にコピーして使い始めてください。

src/components/InputExample.tsx
import { Input, Stack } from "@pelagornis/page/components";
export default function InputDemo() {
return (
<Stack gap="sizeSmall" className="w-full max-w-sm">
<Input placeholder="Default" aria-label="Default" fullWidth />
<Input size="lg" placeholder="Large" aria-label="Large" fullWidth />
<Input error defaultValue="Invalid value" aria-label="Error" fullWidth />
<Input success defaultValue="Looks good" aria-label="Success" fullWidth />
<Input disabled placeholder="Disabled" aria-label="Disabled" fullWidth />
</Stack>
);
}

Input は .mdx ページにそのまま書けます。frontmatter の下でインポートしてください。サーバーで描画されるので、client ディレクティブは要りません。

src/content/docs/example.mdx
---
title: Example
---
import { Input } from "@pelagornis/page/components";
<Input placeholder="you@example.com" aria-label="Email" />

pageMarkdoc() がこのコンポーネントの input タグを登録します。markdoc.config.mjs にプリセットを一度追加すれば(Markdoc で使うを参照)、どの .mdoc ページでもタグを書けます。

src/content/docs/example.mdoc
{% input placeholder="you@example.com" ariaLabel="Email" /%}

属性の名前と値は React の props と同じです。

各 variant prop が受け付ける値です。

Prop値
sizesm md lg

コンポーネントを構成するパーツと、それぞれが描画する data-refineui のロールです。

パーツロール
rootinput