nili/ui
كل المكوّنات

TextInput

عرض شامل
٢٧ تصدير٨ محور تنويع١٣٤ خاصيّة٩ ملف
import { CounterInput, DigitInput, InlineInput, InputSelect, TagInput, TextInput } from '@nili/ui';

هذه صفحة العرض الشامل الخاصة بالمكتبة، معروضة حيّة. غيّر اللغة أو السمة من الأعلى وسَتتبعك.

الأنواع

اثنا عشر إعدادًا من صفحة فيجما. ويضبط كلٌّ منها لوحة المفاتيح والملء التلقائي والاتجاه بحسب نوع القيمة المطلوبة. والزخارف فتحات — startIcon وendIcon وstartAffix وendAffix وselect وbutton وemojiPicker.

هذا نص تلميحي لمساعدة المستخدم.

هذا نص تلميحي لمساعدة المستخدم.

هذا نص تلميحي لمساعدة المستخدم.

هذا نص تلميحي لمساعدة المستخدم.

https://

هذا نص تلميحي لمساعدة المستخدم.

$

هذا نص تلميحي لمساعدة المستخدم.

هذا نص تلميحي لمساعدة المستخدم.

هذا نص تلميحي لمساعدة المستخدم.

هذا نص تلميحي لمساعدة المستخدم.

هذا نص تلميحي لمساعدة المستخدم.

هذا نص تلميحي لمساعدة المستخدم.

هذا نص تلميحي لمساعدة المستخدم.

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 على حقل فارغ آخر وسم.

  • Berlin
  • London
  • Paris

اضغط Enter لإضافة وسم

  • Tehran
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"
    />
  )
}

إدخال العدّاد

حقل رقمي بعنصري زيادة ونقصان ملتصقين به.

2

بين ١ و١٠

2

بين ١ و١٠

2

بين ١ و١٠

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>
      }
    />
  )
}