From 4f4f3bd7a90e988a9fe138e052b3efc01915c21d Mon Sep 17 00:00:00 2001 From: "translate-react-bot[bot]" <251169733+translate-react-bot[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 15:32:38 +0000 Subject: [PATCH 1/2] =?UTF-8?q?docs:=20translate=20`input.md`=20to=20?= =?UTF-8?q?=D0=A0=D1=83=D1=81=D1=81=D0=BA=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reference/react-dom/components/input.md | 258 +++++++++--------- 1 file changed, 129 insertions(+), 129 deletions(-) diff --git a/src/content/reference/react-dom/components/input.md b/src/content/reference/react-dom/components/input.md index b6214249d7..88941fe486 100644 --- a/src/content/reference/react-dom/components/input.md +++ b/src/content/reference/react-dom/components/input.md @@ -1,10 +1,10 @@ --- -title: "" +title: "``" --- - +```html -The [built-in browser `` component](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) lets you render different kinds of form inputs. +Встроенный [компонент `` браузера](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input) позволяет отображать различные виды полей ввода формы. ```js @@ -16,94 +16,94 @@ The [built-in browser `` component](https://developer.mozilla.org/en-US/d --- -## Reference {/*reference*/} +## Справочник {/*reference*/} ### `` {/*input*/} -To display an input, render the [built-in browser ``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) component. +Чтобы отобразить поле ввода, отрендерите [встроенный компонент ``](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input) браузера. ```js ``` -[See more examples below.](#usage) - -#### Props {/*props*/} - -`` supports all [common element props.](/reference/react-dom/components/common#props) - -- [`formAction`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#formaction): A string or function. Overrides the parent `
` for `type="submit"` and `type="image"`. When a URL is passed to `action` the form will behave like a standard HTML form. When a function is passed to `formAction` the function will handle the form submission. See [``](/reference/react-dom/components/form#props). - -You can [make an input controlled](#controlling-an-input-with-a-state-variable) by passing one of these props: - -* [`checked`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement#checked): A boolean. For a checkbox input or a radio button, controls whether it is selected. -* [`value`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement#value): A string. For a text input, controls its text. (For a radio button, specifies its form data.) - -When you pass either of them, you must also pass an `onChange` handler that updates the passed value. - -These `` props are only relevant for uncontrolled inputs: - -* [`defaultChecked`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement#defaultChecked): A boolean. Specifies [the initial value](#providing-an-initial-value-for-an-input) for `type="checkbox"` and `type="radio"` inputs. -* [`defaultValue`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement#defaultValue): A string. Specifies [the initial value](#providing-an-initial-value-for-an-input) for a text input. - -These `` props are relevant both for uncontrolled and controlled inputs: - -* [`accept`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#accept): A string. Specifies which filetypes are accepted by a `type="file"` input. -* [`alt`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#alt): A string. Specifies the alternative image text for a `type="image"` input. -* [`capture`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#capture): A string. Specifies the media (microphone, video, or camera) captured by a `type="file"` input. -* [`autoComplete`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#autocomplete): A string. Specifies one of the possible [autocomplete behaviors.](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values) -* [`autoFocus`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#autofocus): A boolean. If `true`, React will focus the element on mount. -* [`dirname`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#dirname): A string. Specifies the form field name for the element's directionality. -* [`disabled`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#disabled): A boolean. If `true`, the input will not be interactive and will appear dimmed. -* `children`: `` does not accept children. -* [`form`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#form): A string. Specifies the `id` of the `` this input belongs to. If omitted, it's the closest parent form. -* [`formAction`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#formaction): A string. Overrides the parent `` for `type="submit"` and `type="image"`. -* [`formEnctype`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#formenctype): A string. Overrides the parent `` for `type="submit"` and `type="image"`. -* [`formMethod`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#formmethod): A string. Overrides the parent `` for `type="submit"` and `type="image"`. -* [`formNoValidate`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#formnovalidate): A string. Overrides the parent `` for `type="submit"` and `type="image"`. -* [`formTarget`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#formtarget): A string. Overrides the parent `` for `type="submit"` and `type="image"`. -* [`height`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#height): A string. Specifies the image height for `type="image"`. -* [`list`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#list): A string. Specifies the `id` of the `` with the autocomplete options. -* [`max`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#max): A number. Specifies the maximum value of numerical and datetime inputs. -* [`maxLength`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength): A number. Specifies the maximum length of text and other inputs. -* [`min`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#min): A number. Specifies the minimum value of numerical and datetime inputs. -* [`minLength`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength): A number. Specifies the minimum length of text and other inputs. -* [`multiple`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#multiple): A boolean. Specifies whether multiple values are allowed for `` changes. React extends the `onSelect` event to also fire for empty selection and on edits (which may affect the selection). -* `onSelectCapture`: A version of `onSelect` that fires in the [capture phase.](/learn/responding-to-events#capture-phase-events) -* [`pattern`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#pattern): A string. Specifies the pattern that the `value` must match. -* [`placeholder`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder): A string. Displayed in a dimmed color when the input value is empty. -* [`readOnly`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#readonly): A boolean. If `true`, the input is not editable by the user. -* [`required`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#required): A boolean. If `true`, the value must be provided for the form to submit. -* [`size`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#size): A number. Similar to setting width, but the unit depends on the control. -* [`src`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#src): A string. Specifies the image source for a `type="image"` input. -* [`step`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step): A positive number or an `'any'` string. Specifies the distance between valid values. -* [`type`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#type): A string. One of the [input types.](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types) -* [`width`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#width): A string. Specifies the image width for a `type="image"` input. - -#### Caveats {/*caveats*/} - -- Checkboxes need `checked` (or `defaultChecked`), not `value` (or `defaultValue`). -- If a text input receives a string `value` prop, it will be [treated as controlled.](#controlling-an-input-with-a-state-variable) -- If a checkbox or a radio button receives a boolean `checked` prop, it will be [treated as controlled.](#controlling-an-input-with-a-state-variable) -- An input can't be both controlled and uncontrolled at the same time. -- An input cannot switch between being controlled or uncontrolled over its lifetime. -- Every controlled input needs an `onChange` event handler that synchronously updates its backing value. +[См. больше примеров ниже.](#usage) + +#### Пропсы {/*props*/} + +`` поддерживает все [общие пропсы элементов.](/reference/react-dom/components/common#props) + +- [`formAction`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#formaction): Строка или функция. Переопределяет родительский `` для `type="submit"` и `type="image"`. Когда URL передается в `action`, форма будет вести себя как стандартная HTML-форма. Когда функция передается в `formAction`, функция будет обрабатывать отправку формы. См. [``](/reference/react-dom/components/form#props). + +Вы можете [сделать поле ввода управляемым](#controlling-an-input-with-a-state-variable), передав один из этих пропсов: + +* [`checked`](https://developer.mozilla.org/ru/docs/Web/API/HTMLInputElement#checked): Логическое значение. Для флажка или переключателя определяет, выбран ли он. +* [`value`](https://developer.mozilla.org/ru/docs/Web/API/HTMLInputElement#value): Строка. Для текстового поля ввода управляет его текстом. (Для переключателя указывает данные формы.) + +Когда вы передаете любой из них, вы также должны передать обработчик `onChange`, который обновляет переданное значение. + +Эти пропсы `` актуальны только для неуправляемых полей ввода: + +* [`defaultChecked`](https://developer.mozilla.org/ru/docs/Web/API/HTMLInputElement#defaultChecked): Логическое значение. Указывает [начальное значение](#providing-an-initial-value-for-an-input) для полей ввода `type="checkbox"` и `type="radio"`. +* [`defaultValue`](https://developer.mozilla.org/ru/docs/Web/API/HTMLInputElement#defaultValue): Строка. Указывает [начальное значение](#providing-an-initial-value-for-an-input) для текстового поля ввода. + +Эти пропсы `` актуальны как для неуправляемых, так и для управляемых полей ввода: + +* [`accept`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#accept): Строка. Указывает, какие типы файлов принимаются полем ввода `type="file"`. +* [`alt`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#alt): Строка. Указывает альтернативный текст изображения для поля ввода `type="image"`. +* [`capture`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#capture): Строка. Указывает носитель (микрофон, видео или камеру), захватываемый полем ввода `type="file"`. +* [`autoComplete`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#autocomplete): Строка. Указывает одно из возможных [поведений автозаполнения.](https://developer.mozilla.org/ru/docs/Web/HTML/Attributes/autocomplete#values) +* [`autoFocus`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#autofocus): Логическое значение. Если `true`, React сфокусирует элемент при монтировании. +* [`dirname`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#dirname): Строка. Указывает имя поля формы для направленности элемента. +* [`disabled`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#disabled): Логическое значение. Если `true`, поле ввода не будет интерактивным и будет отображаться тусклым. +* `children`: `` не принимает дочерние элементы. +* [`form`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#form): Строка. Указывает `id` ``, к которой принадлежит это поле ввода. Если опущено, это ближайшая родительская форма. +* [`formAction`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#formaction): Строка. Переопределяет родительский `` для `type="submit"` и `type="image"`. +* [`formEnctype`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#formenctype): Строка. Переопределяет родительский `` для `type="submit"` и `type="image"`. +* [`formMethod`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#formmethod): Строка. Переопределяет родительский `` для `type="submit"` и `type="image"`. +* [`formNoValidate`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#formnovalidate): Строка. Переопределяет родительский `` для `type="submit"` и `type="image"`. +* [`formTarget`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#formtarget): Строка. Переопределяет родительский `` для `type="submit"` и `type="image"`. +* [`height`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#height): Строка. Указывает высоту изображения для `type="image"`. +* [`list`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#list): Строка. Указывает `id` `` с параметрами автозаполнения. +* [`max`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#max): Число. Указывает максимальное значение числовых и datetime полей ввода. +* [`maxLength`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#maxlength): Число. Указывает максимальную длину текста и других полей ввода. +* [`min`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#min): Число. Указывает минимальное значение числовых и datetime полей ввода. +* [`minLength`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#minlength): Число. Указывает минимальную длину текста и других полей ввода. +* [`multiple`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#multiple): Логическое значение. Указывает, разрешено ли несколько значений для ``. React расширяет событие `onSelect`, чтобы оно также срабатывало для пустого выделения и при редактировании (что может повлиять на выделение). +* `onSelectCapture`: Версия `onSelect`, которая срабатывает на [фазе захвата.](/learn/responding-to-events#capture-phase-events) +* [`pattern`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#pattern): Строка. Указывает шаблон, которому должно соответствовать `value`. +* [`placeholder`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#placeholder): Строка. Отображается тусклым цветом, когда значение поля ввода пусто. +* [`readOnly`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#readonly): Логическое значение. Если `true`, поле ввода не редактируется пользователем. +* [`required`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#required): Логическое значение. Если `true`, значение должно быть предоставлено для отправки формы. +* [`size`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#size): Число. Аналогично установке ширины, но единица измерения зависит от элемента управления. +* [`src`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#src): Строка. Указывает источник изображения для поля ввода `type="image"`. +* [`step`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#step): Положительное число или строка `'any'`. Указывает расстояние между допустимыми значениями. +* [`type`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#type): Строка. Один из [типов ввода.](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#input_types) +* [`width`](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#width): Строка. Указывает ширину изображения для поля ввода `type="image"`. + +#### Предостережения {/*caveats*/} + +- Флажки требуют `checked` (или `defaultChecked`), а не `value` (или `defaultValue`). +- Если текстовое поле ввода получает строковый проп `value`, оно будет [рассматриваться как управляемое.](#controlling-an-input-with-a-state-variable) +- Если флажок или переключатель получает логический проп `checked`, он будет [рассматриваться как управляемый.](#controlling-an-input-with-a-state-variable) +- Поле ввода не может быть одновременно управляемым и неуправляемым. +- Поле ввода не может переключаться между управляемым и неуправляемым в течение своего жизненного цикла. +- Каждому управляемому полю ввода требуется обработчик события `onChange`, который синхронно обновляет его базовое значение. --- -## Usage {/*usage*/} +## Использование {/*usage*/} -### Displaying inputs of different types {/*displaying-inputs-of-different-types*/} +### Отображение полей ввода разных типов {/*displaying-inputs-of-different-types*/} -To display an input, render an `` component. By default, it will be a text input. You can pass `type="checkbox"` for a checkbox, `type="radio"` for a radio button, [or one of the other input types.](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types) +Чтобы отобразить поле ввода, отрендерите компонент ``. По умолчанию это будет текстовое поле ввода. Вы можете передать `type="checkbox"` для флажка, `type="radio"` для переключателя [или один из других типов ввода.](https://developer.mozilla.org/ru/docs/Web/HTML/Element/input#input_types) @@ -148,11 +148,11 @@ input { margin: 5px; } --- -### Providing a label for an input {/*providing-a-label-for-an-input*/} +### Предоставление метки для поля ввода {/*providing-a-label-for-an-input*/} -Typically, you will place every `` inside a [`