TextInput
عرض شاملimport { CounterInput, DigitInput, InlineInput, InputSelect, TagInput, TextInput } from '@nili/ui';هذه صفحة العرض الشامل الخاصة بالمكتبة، معروضة حيّة. غيّر اللغة أو السمة من الأعلى وسَتتبعك.
الأنواع
اثنا عشر إعدادًا من صفحة فيجما. ويضبط كلٌّ منها لوحة المفاتيح والملء التلقائي والاتجاه بحسب نوع القيمة المطلوبة. والزخارف فتحات — startIcon وendIcon وstartAffix وendAffix وselect وbutton وemojiPicker.
هذا نص تلميحي لمساعدة المستخدم.
هذا نص تلميحي لمساعدة المستخدم.
هذا نص تلميحي لمساعدة المستخدم.
هذا نص تلميحي لمساعدة المستخدم.
هذا نص تلميحي لمساعدة المستخدم.
هذا نص تلميحي لمساعدة المستخدم.
هذا نص تلميحي لمساعدة المستخدم.
هذا نص تلميحي لمساعدة المستخدم.
هذا نص تلميحي لمساعدة المستخدم.
هذا نص تلميحي لمساعدة المستخدم.
هذا نص تلميحي لمساعدة المستخدم.
هذا نص تلميحي لمساعدة المستخدم.
import {
TextInput,
InputSelect,
Icon,
Button,
CompactButton,
} from "@nili/ui"
import { RiMailLine, RiSearchLine, RiBankCardLine } from "@remixicon/react"
export function Example() {
return (
<>
<TextInput
type="email"
label="Email Address"
sublabel="(Optional)"
information
hint="This is a hint text to help user."
placeholder="hello@nili.design"
startIcon={<Icon icon={RiMailLine} />}
required
/>
<TextInput
type="phone"
label="Phone Number"
select={
<InputSelect icon={<span>🇺🇸</span>} aria-label="Country code">
+1
</InputSelect>
}
/>
<TextInput type="website" label="Website" startAffix="https://" />
<TextInput
type="amount"
label="Amount"
prefix="$"
select={
<InputSelect icon={<span>🇪🇺</span>} aria-label="Currency">
EUR
</InputSelect>
}
/>
</>
)
}الحالات والأحجام
الافتراضي والمملوء والمعطّل والخطأ عبر الأحجام الثلاثة. والتحويم والتركيز حالتان في CSS، فلم تُرسما هنا.
أدخل عنوان بريد صالحًا
import { TextInput } from "@nili/ui"
export function Example() {
return (
<>
<TextInput label="Default" placeholder="Enter text..." />
<TextInput label="Filled" defaultValue="hello@nili.design" type="email" />
<TextInput label="Disabled" defaultValue="Locked" disabled />
<TextInput
label="Error"
defaultValue="not-an-email"
type="email"
error="Enter a valid email address"
/>
<TextInput size="sm" label="Small" />
<TextInput size="xs" label="X-Small" />
</>
)
}إدخال الوسوم
حقل مخصّص لإنشاء الوسوم وإدارتها. يثبّت Enter أو الفاصلة، ويزيل Backspace على حقل فارغ آخر وسم.
اضغط Enter لإضافة وسم
import { TagInput } from "@nili/ui"
export function Example() {
return (
<TagInput
label="Cities"
hint="Press Enter to add a tag"
defaultValue={["Berlin", "London", "Paris"]}
placeholder="Add a city..."
dismissLabel="Remove"
/>
)
}إدخال العدّاد
حقل رقمي بعنصري زيادة ونقصان ملتصقين به.
بين ١ و١٠
بين ١ و١٠
بين ١ و١٠
import { CounterInput } from "@nili/ui"
export function Example() {
return (
<CounterInput
label="Guests"
hint="Between 1 and 10"
defaultValue={2}
min={1}
max={10}
decrementLabel="Decrease"
incrementLabel="Increase"
/>
)
}إدخال الأرقام
يلتقط البيانات الرقمية رقمًا رقمًا — رموز لمرة واحدة وأرقام سرّية. واللصق يملأ المجموعة كلها.
أرسلنا رمزًا إلى هاتفك
هذا الرمز غير صحيح
import { DigitInput } from "@nili/ui"
export function Example() {
return (
<>
<DigitInput
length={4}
label="Verification code"
hint="We sent a code to your phone"
groupLabel="Verification code"
cellLabel={(index, total) => `Digit ${index} of ${total}`}
/>
<DigitInput
length={6}
error={t('f.codeWrong')}
defaultValue="123"
groupLabel="PIN"
cellLabel={(index, total) => `Digit ${index} of ${total}`}
/>
</>
)
}الإدخال المضمّن
حقل مدمج لتحرير البيانات في مكانها. ولا يظهر الإطار إلا عند التحويم والتركيز — فيُقرأ نصًّا حتى تلمسه.
import { InlineInput, Icon, CompactButton } from "@nili/ui"
import { RiUser3Line, RiPencilLine } from "@remixicon/react"
export function Example() {
return (
<InlineInput
label="Display name"
placeholder="Enter a name"
defaultValue="Ada Lovelace"
startIcon={<Icon icon={RiUser3Line} />}
button={
<CompactButton appearance="ghost" size="md" aria-label="Edit">
<Icon icon={RiPencilLine} />
</CompactButton>
}
/>
)
}CounterInput
باقي الخصائص
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| size | md | sm | xs | md | Figma `📏 Size` — Medium (40) · Small (36) · X-Small (32). |
| label | ReactNode | — | Figma `🔖 Label`. Omit to hide. |
| hint | ReactNode | — | Figma `💡 Hint Text`. Omit to hide. |
| error | ReactNode | — | Marks the field invalid *and* supplies the message. Figma `State=Error`. |
| required | boolean | — | |
| value | number | — | |
| defaultValue | number | 0 | |
| onValueChange | (value: number) => void | — | |
| min | number | 0 | |
| max | number | — | |
| step | number | 1 | |
| disabled | boolean | — | |
| locale | string | — | Digits follow the locale, so `16` renders in Persian digits under `fa`. |
| formatValue | (value: number) => string | — | Overrides the rendered value — units, currency, `2 hrs`. |
| decrementLabel* | string | — | Accessible names for the two buttons. Required, not optional: an icon-only button with no accessible name is announced as just "button". |
| incrementLabel* | string | — | |
| id | string | — | |
| name | string | — | |
| className | string | — | |
| rootClassName | string | — | |
| fieldClassName | string | — |
DigitInput
باقي الخصائص
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| length | number | 4 | How many cells. Figma draws one; the count is yours. |
| value | string | — | |
| defaultValue | string | ||
| onValueChange | (value: string) => void | — | |
| onComplete | (value: string) => void | — | Fires once the last cell is filled. |
| label | ReactNode | — | |
| hint | ReactNode | — | |
| error | ReactNode | — | Marks every cell invalid *and* supplies the message. Figma `State=Error`. |
| required | boolean | — | |
| disabled | boolean | — | |
| autoComplete | string | one-time-code | `one-time-code` by default, which is what lets iOS and Android autofill. |
| groupLabel | string | — | Accessible name for the group, e.g. `'Verification code'`. |
| cellLabel | (index: string, total: string) => string | — | Names each cell for a screen reader: `(index, total) => string`. |
| id | string | — | |
| name | string | — | |
| className | string | — | |
| rootClassName | string | — |
InlineInput
extends Omit< ComponentPropsWithoutRef<'input'>, 'size' >
باقي الخصائص
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| disabled | boolean | — | |
| required | boolean | — | |
| readOnly | boolean | — | |
| checked | boolean | — | |
| defaultChecked | boolean | — | |
| placeholder | string | — | |
| value | string | — | |
| defaultValue | string | — | |
| name | string | — | |
| maxLength | number | — | |
| autoComplete | string | — | |
| aria-label | string | — | |
| startIcon | ReactNode | — | Figma `⬅️ Left Icon` / `⬅️ Pick Left`. |
| button | ReactNode | — | Figma `🕹️ Button` — a trailing CompactButton, usually a pencil. |
| invalid | boolean | false | Marks the field invalid. There is no message slot: this control is inline. |
| label | string | — | Accessible name, since an inline field rarely has a visible label. |
| rootClassName | string | — |
InputSelect
extends Omit< ComponentPropsWithoutRef<'button'>, 'children' >
باقي الخصائص
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| children | ReactNode | — | Figma `✏️ Edit Text` — `+98`, `EUR`, `can view`. |
| disabled | boolean | — | |
| required | boolean | — | |
| readOnly | boolean | — | |
| value | string | — | |
| defaultValue | string | — | |
| name | string | — | |
| aria-label | string | — | |
| size | md | sm | xs | md | |
| icon | ReactNode | — | Figma `🌍 Pick Country` — a flag, a currency mark, any leading glyph. |
| chevron | boolean | true | Hides the chevron for a display-only affix. |
TagInput
باقي الخصائص
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| size | md | sm | xs | md | Figma `📏 Size` — Medium (40) · Small (36) · X-Small (32). |
| label | ReactNode | — | Figma `🔖 Label`. Omit to hide. |
| hint | ReactNode | — | Figma `💡 Hint Text`. Omit to hide. |
| error | ReactNode | — | Marks the field invalid *and* supplies the message. Figma `State=Error`. |
| required | boolean | — | |
| startIcon | ReactNode | — | Figma `⬅️ Left Icon` / `⬅️ Pick Left`. |
| value | string[] | — | The tags. Controlled. |
| defaultValue | string[] | — | |
| onValueChange | (tags: string[]) => void | — | |
| placeholder | string | — | |
| maxTags | number | — | Refuses to add beyond this many. |
| dismissLabel | string | — | Accessible name for each tag's dismiss button, e.g. `'Remove'`. |
| disabled | boolean | — | |
| id | string | — | |
| name | string | — | |
| className | string | — | |
| rootClassName | string | — | |
| fieldClassName | string | — |
TextInput
extends Omit< ComponentPropsWithoutRef<'input'>, 'size' | 'type' | 'prefix' >
باقي الخصائص
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| disabled | boolean | — | |
| required | boolean | — | |
| readOnly | boolean | — | |
| checked | boolean | — | |
| defaultChecked | boolean | — | |
| placeholder | string | — | |
| value | string | — | |
| defaultValue | string | — | |
| name | string | — | |
| maxLength | number | — | |
| autoComplete | string | — | |
| aria-label | string | — | |
| size | md | sm | xs | md | |
| type | basic | button | search | card | emoji | email | phone | website | amount | date | password | dropdown | basic | Figma's `Type`. Sets the input mode, autofill hint and direction for the kind of value being asked for; see {@link TextInputType}. |
| htmlType | ComponentPropsWithoutRef<'input'>['type'] | — | Escape hatch: forces the native attribute when the preset gets it wrong. |
| label | ReactNode | — | Rendered above the field and tied to it. |
| sublabel | ReactNode | — | Figma Label's `💬 Sublabel` — the muted "(Optional)" beside the label. |
| information | boolean | ReactNode | false | Figma Label's `ℹ️ Information` glyph. `true` uses the default icon. |
| informationLabel | string | — | Accessible name for that glyph. |
| labelAction | ReactNode | — | Figma Label's `🌟 Button` — trailing slot on the label row. |
| hint | ReactNode | — | The line under the field. Becomes the error message when `error` is set. |
| error | ReactNode | — | Validation message. Its presence is what marks the field invalid, so the two can never disagree — a red border with no message, or a message with a field that still looks fine. |
| startIcon | ReactNode | — | Icon inside the field, on the leading edge. |
| endIcon | ReactNode | — | Icon or control inside the field, on the trailing edge. |
| startAffix | ReactNode | — | Attached block before the field — `https://`, a currency. |
| endAffix | ReactNode | — | Attached block after the field — `.com`, a unit. |
| shortcut | ReactNode | — | `type="search"` — the keyboard shortcut chip on the trailing edge (⌘K). |
| cardProvider | ReactNode | — | `type="card"` — the detected card brand, shown once enough digits exist. |
| strength | PasswordStrengthLevel | false | false | `type="password"` — wires the existing `PasswordStrength` meter under the field. Pass a level, or `false` to hide it. |
| strengthLabel | string | — | Text read out beside the strength meter, e.g. `'Strong password'`. |
| emojiPicker | ReactNode | — | `type="emoji"` — the picker trigger on the leading edge. |
| select | ReactNode | — | `type="dropdown"` — an attached `<Dropdown>` sharing the field's border. |
| button | ReactNode | — | `type="button"` — an attached action sharing the field's border. |
| reveal | boolean | true | Shows a reveal toggle on a password field. On by default — a field nobody can read back is a field people get wrong twice and then paste from a note. Turn it off where a shoulder is the threat model. |
| revealLabel | string | Show password | Accessible name for the reveal toggle while the value is hidden. |
| hideLabel | string | Hide password | Accessible name for the reveal toggle while the value is visible. |
| suffix | ReactNode | — | Figma's `Suffix` — muted text pinned inside the trailing edge. |
| prefix | ReactNode | — | Muted text before the value — Figma's `€` on an Amount field. |
| selectPosition | start | end | — | Overrides which edge `select` sits on. Defaults to the type's own side: `start` for Phone, `end` for Amount and Dropdown. |
| latin | boolean | — | Pins the field to left-to-right regardless of the ambient direction. |
| rootClassName | string | — | Wrapper class. Use `className` for the `<input>` itself. |
| fieldClassName | string | — | Class for the bordered field box. |
TextInputAdornment
داخليمحاور التنويع — من تعريف cva للمكوّن
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| side | start | end | start | |
| size | md | sm | xs | md |
TextInputAffix
داخليمحاور التنويع — من تعريف cva للمكوّن
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| side | start | end | start | |
| size | md | sm | xs | md |
TextInputAttached
داخليمحاور التنويع — من تعريف cva للمكوّن
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| side | start | end | end |
TextInputControl
داخليمحاور التنويع — من تعريف cva للمكوّن
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| size | md | sm | xs | md |
TextInputField
داخليمحاور التنويع — من تعريف cva للمكوّن
| الخاصيّة | النوع | الافتراضي | ملاحظات |
|---|---|---|---|
| size | md | sm | xs | md | |
| invalid | 'true' | 'false' | false |