> ## Documentation Index
> Fetch the complete documentation index at: https://docs.twenty.com/llms.txt
> Use this file to discover all available pages before exploring further.

# إدخال

> حقل إدخال نصي بسمات أصلية وتكامل مع الحقول وحجمين.

## نظرة عامة

يعرض `Input` حقل إدخال نصي ويقبل سمات الإدخال الأصلية مثل `type` و`name` و`required` و`disabled` و`autoComplete`.

> [tab] Light
>
> [مثال على الإدخال (light)](https://storybook.twenty.com/iframe.html?id=ui-input-input--display\&viewMode=story\&globals=colorScheme:light)

> [tab] Dark
>
> [مثال على الإدخال (dark)](https://storybook.twenty.com/iframe.html?id=ui-input-input--display\&viewMode=story\&globals=colorScheme:dark)

[Open in Storybook](https://storybook.twenty.com/?path=/story/ui-input-input--display)

## استخدام

### الحالة غير المتحكم بها

استخدم `defaultValue` لتعيين عنوان البريد الإلكتروني الأولي. يتحكم الإدخال في التغييرات اللاحقة.

```tsx theme={null}
import { Field, Input } from 'twenty-ui/primitives/input';

export const EmailField = () => (
  <Field.Root>
    <Field.Label>Email</Field.Label>
    <Input
      name="email"
      type="email"
      autoComplete="email"
      defaultValue="alex@example.com"
    />
    <Field.Description>Use your work email address.</Field.Description>
  </Field.Root>
);
```

## الخيارات المرئية

قارن بين حقول الإدخال الصغيرة والمتوسطة في حالاتها الافتراضية، والمركّزة، وغير الصالحة، والمعطّلة. استخدم ملاحظات التحقق إلى جانب تنسيق الحالة غير الصالحة.

> [tab] Light
>
> [الخيارات المرئية لحقل الإدخال (light)](https://storybook.twenty.com/iframe.html?id=ui-input-input--catalog\&viewMode=story\&globals=colorScheme:light)

> [tab] Dark
>
> [الخيارات المرئية لحقل الإدخال (dark)](https://storybook.twenty.com/iframe.html?id=ui-input-input--catalog\&viewMode=story\&globals=colorScheme:dark)

[Open in Storybook](https://storybook.twenty.com/?path=/story/ui-input-input--catalog)

## مظهر عادي

استخدم `variant="plain"` داخل صف أو سطح موجود. يزيل التعبئة والحدود والزوايا المستديرة والحشوة، ويستخدم الارتفاع الطبيعي. يوفر العنصر الأب التباعد وأبعاد الصف. تظل أنماط النص والعنصر النائب والحالة المعطلة مشتركة. يتبع المخطط الأزرق سلوك المتصفح الأصلي لـ `:focus-visible`. بالنسبة إلى عناصر التحكم النصية، يمكن أن يشمل ذلك تركيز المؤشر والتركيز التلقائي، بالإضافة إلى تركيز لوحة المفاتيح. تستخدم الحالة غير الصالحة مخططًا تحذيريًا دون تغيير التخطيط.

```tsx theme={null}
import { Field, Input } from 'twenty-ui/primitives/input';

export const InlineSubject = () => (
  <Field.Root>
    <Field.Label>Subject</Field.Label>
    <Input variant="plain" placeholder="Add a subject" />
  </Field.Root>
);
```

يمنح `InputGroup` حقل الإدخال الخاص به تلقائيًا المظهر البسيط، ويحافظ على المجموعة باعتبارها إطار التركيز والتحقق الوحيد. يبقى ارتفاعا `sm` و`md` 24px و32px. لا تستخدم حقول الإدخال البسيطة المستقلة الارتفاع الثابت المرتبط بـ`size`.

## الحالة المتحكم بها

مرر `value` وحدّثه باستخدام `onValueChange` للتحكم في عنوان البريد الإلكتروني نفسه في حالة React. تتلقى دالة رد النداء قيمة السلسلة التالية وتفاصيل الحدث.

```tsx theme={null}
import { useState } from 'react';
import { Field, Input } from 'twenty-ui/primitives/input';

export const EmailField = () => {
  const [email, setEmail] = useState('alex@example.com');

  return (
    <Field.Root>
      <Field.Label>Email</Field.Label>
      <Input
        name="email"
        type="email"
        autoComplete="email"
        value={email}
        onValueChange={setEmail}
      />
      <Field.Description>Use your work email address.</Field.Description>
    </Field.Root>
  );
};
```

## أضف ملحقا

يمتلك `InputGroup` الحد المحيط وارتفاع التخطيط. يُحدَّد حجم الإدخال من `size` الصريح للعنصر الابن، ثم الإعداد الافتراضي للمجموعة، ثم `md`. يتمدد الإدخال المجمّع داخل الحد المشترك، لذا استخدم `size` الخاص بالمجموعة لتغيير الارتفاع الكلي للحقل.

```tsx theme={null}
import { IconSearch } from 'twenty-ui/icon';
import { Input, InputGroup } from 'twenty-ui/primitives/input';

export const CompactSearch = () => (
  <InputGroup size="sm" startElement={<IconSearch size={16} aria-hidden />}>
    <Input aria-label="Search contacts" />
  </InputGroup>
);
```

## تخصيص عنصر التحكم الأصلي والغلاف

تستهدف السمات الأصلية والمعالجات و`className` و`style` و`ref` الإدخال. يتلقى ref عنصر `HTMLInputElement`. استخدم `render` لتكوين مكوّن إدخال آخر وتمرير الخصائص وref المتوفرين إلى الإدخال الأصلي الخاص به.

يتلقى `onChange` حدث تغيير من React للإدخال الأصلي. يتلقى `onValueChange(value, details)` السلسلة التالية وتفاصيل حدث Base UI، بما في ذلك `event` و`reason` و`cancel` و`allowPropagation`. يستهدف الحدث الإدخال. يحافظ إلغاء التفاصيل على نهج التحقق في Base UI؛ ولا يتراجع عن تعديل أصلي. يحدد المستدعون المتحكمون القيمة التي ستُعتمد.

ضع أنماط التخطيط والسمات وrefs على `InputGroup` عند تخصيص الغلاف المحيط. لا تمتلك المجموعة أي قيمة. تبقى `name` و`form` و`required` و`readOnly` و`disabled` الأصلية، وسلوك الإرسال وإعادة التعيين على الإدخال، مع توفير التسمية والتحقق لـ Field عبر `Field.Root`.

## الإزاحة

يتضمن المرجع خصائص Base UI الخاصة بالمكوّن والموروثة. تُقبل أيضا سمات الإدخال الأصلية. يكون الإدخال المستقل افتراضيًا `md`؛ وداخل مجموعة، يرث `size` الإدخال المحذوف حجم المجموعة.

**className** `string | ((state: InputState) =\> string | undefined)`

CSS class applied to the element, or a function that
returns a class based on the component's state.

**defaultValue** `string | number | readonly string[]`

The default value of the input. Use when uncontrolled.

**hasFocusRing** `boolean` (default: true)

Set false to hide the focus border or outline while keeping errors visible. Defaults to true. InputGroup controls grouped focus styling.

**onValueChange** `((value: string, eventDetails: \{ reason: "none"; event: Event; cancel: () =\> void; allowPropagation: () =\> void; isCanceled: boolean; isPropagationAllowed: boolean; trigger: Element | undefined; \}) =\> void)`

Receives the next string value and Base UI details, including the native event, reason and cancellation methods.

**ref** `Ref\<HTMLInputElement\>`

Ref to the native input element.

**render** `ReactElement\<unknown, string | JSXElementConstructor\<any\>\> | ComponentRenderFn\<HTMLProps, InputState\>`

Composes the native input with a custom element or render callback. Forward the supplied props and ref to an input.

**size** `"md" | "sm"`

Visual size. Explicit input size takes precedence over the InputGroup default, then md applies. Group layout still sets the surrounding height.

**style** `CSSProperties | ((state: InputState) =\> CSSProperties | undefined)`

Style applied to the element, or a function that
returns a style object based on the component's state.

**textAlign** `"end" | "start"`

Aligns text to the logical start or end of the input. Follows the text direction.

**value** `string | number | readonly string[]`

The value of the input. Use when controlled.

**variant** `"default" | "plain"` (default: default)

default keeps the field frame. plain removes fill, border, radius and padding and uses natural height. Its outline follows native :focus-visible, including pointer focus or autofocus on text inputs; invalid state uses a danger outline. InputGroup always owns the grouped frame.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.