diff --git a/src/content/reference/react-dom/components/input.md b/src/content/reference/react-dom/components/input.md index 06010d301..4a62b6a7e 100644 --- a/src/content/reference/react-dom/components/input.md +++ b/src/content/reference/react-dom/components/input.md @@ -4,7 +4,7 @@ title: "" -The [built-in browser `` component](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) lets you render different kinds of form inputs. +[Tarayıcıya yerleşik `` bileşeni](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) farklı türden form girdileri render etmenizi sağlar. ```js @@ -16,93 +16,94 @@ The [built-in browser `` component](https://developer.mozilla.org/en-US/d --- -## Reference {/*reference*/} +## Referans {/*reference*/} ### `` {/*input*/} -To display an input, render the [built-in browser ``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) component. +Ekranda bir girdi göstermek için, [tarayıcıya yerleşik ``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) bileşenini render edin. ```js ``` -[See more examples below.](#usage) - -#### Props {/*props*/} - -`` supports all [common element props.](/reference/react-dom/components/common#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. +[Daha fazla örnek için aşağıya bakınız.](#usage) + +#### Prop'lar {/*props*/} + + +`` tüm [ortak eleman proplarını](/reference/react-dom/components/common#props) destekler. + +Aşağıdaki proplardan birini ileterek [girdileri kontrollü hale](#controlling-an-input-with-a-state-variable) getirebilirsiniz: + +* [`checked`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement#checked): Boolean. Onay kutusu girdisi ya da radyo butonunun seçilip seçilmediğini kontrol eder. +* [`value`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement#value): String. Metin kutusunun içindeki metni kontrol eder. (Radyo butonu için, form verisini belirtir.) + +İki propdan birini ilettiğinizde, iletilen değeri güncelleyen `onChange` olay yöneticisini de iletmeniz gerekmektedir. + +Aşağıdaki `` propları sadece kontrolsüz girdilerle ilgilidir: + +* [`defaultChecked`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement#defaultChecked): Boolean. Tipi `type="checkbox"` ve `type="radio"` olan girdiler için [başlangıç değerini](#providing-an-initial-value-for-an-input) belirler. + +* [`defaultValue`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement#defaultValue): String. Metin girdilerinin [başlangıç değerini](#providing-an-initial-value-for-an-input) belirler. + +Aşağıdaki `` proplar hem kontrollü hem de kontrolsüz girdilerle ilgilidir: + +* [`accept`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#accept): String. Tipi `type="file"` olan girdiler için hangi dosya tiplerinin kabul edilebilir olduğunu belirler. +* [`alt`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#alt): String. Tipi `type="image"` olan girdiler için alternatif görüntü metnini belirler. +* [`capture`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#capture): String. Tipi `type="file"` olan girdiler için yakalanan medyayı (mikrofon, video ya da kamera) belirler. +* [`autoComplete`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#autocomplete): String. Olası [otomatik tamamlama davranışları](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values)'ndan birini belirler. +* [`autoFocus`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#autofocus): Boolean. Eğer `true` ise, React, eleman DOM'a eklendikten sonra o elemana odaklanacaktır. +* [`dirname`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#dirname): String. Bileşen yönlendirmesi için form alanı adını belirler. +* [`disabled`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#disabled): Boolean. Eğer `true` ise, girdi etkileşimli olmayacak ve soluk renkli görünecektir. +* `children`: `` alt bileşen kabul etmez. +* [`form`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#form): String. Girdinin ait olduğu ``'un ``'sini belirtir. Eğer belirtilmemişse, ağaçtaki en yakın üst formdur. +* [`formAction`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#formaction): String. Tipi `type="submit"` ve `type="image"` olan girdiler için `` üst bileşenini geçersiz kılar. +* [`formEnctype`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#formenctype): String. Tipi `type="submit"` ve `type="image"` olan girdiler için `` üst bileşenini geçersiz kılar. +* [`formMethod`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#formmethod): String. Tipi `type="submit"` ve `type="image"` olan girdiler için `` üst bileşenini geçersiz kılar. +* [`formNoValidate`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#formnovalidate): String. Tipi `type="submit"` ve `type="image"` olan girdiler için ` üst bileşenini geçersiz kılar. +* [`formTarget`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#formtarget): String. Tipi `type="submit"` and `type="image"` olan girdiler için `` üst bileşenini geçersiz kılar. +* [`height`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#height): String. Tipi `type="image"` olan girdiler için görsel yükseliğini belirler. +* [`list`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#list): String. Otomatik tamamlama seçeneği olan `` bileşeninin `id`'sini belirler. +* [`max`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#max): Numara. Tarih ve nümerik girdilerin maksimumum alabilecekleri değeri belirler. +* [`maxLength`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength): Numara. Metin ve diğer girdi tipleri için maksimum uzunluğu belirler. +* [`min`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#min): Numara. Nümerik ve tarih girdilerin minimum alabilecekleri değeri belirler. +* [`minLength`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength): Numara. Metin ve diğer girdi tipleri için minimum uzunluğu belirler. +* [`multiple`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#multiple): Boolean. Tipi `` içindeki seçilen alanın değişmesiyle tetiklenir. React, `onSelect` olayını boş seçim ve düzenlemelerde de (seçimi etkileyebilir) çalıştırır. +* `onSelectCapture`: `onSelect`'in [yakalama aşamasında](/learn/responding-to-events#capture-phase-events) çalıştırılan bir versiyonudur. +* [`pattern`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#pattern): String. `value` değerinin eşleşmesi gereken şablonu belirler. +* [`placeholder`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder): String. Girdi değeri yokken ekranda soluk renkte görüntülenir. +* [`readOnly`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#readonly): Boolean. Eğer `true` ise, girdi alanı kullanıcı tarafından düzenlenemez. +* [`required`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#required): Boolean. Eğer `true` ise, formun gönderilebilmesi için değer sağlanmalıdır. +* [`size`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#size): Numara. Genişlik ayarına benzerdir ancak birimin türü kontrole bağlıdır. +* [`src`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#src): String. Tipi `type="image"` olan girdiler için görsel kaynağını belirler. +* [`step`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step): Pozitif sayı ya da `'any'` string. Geçerli iki değer araasındaki uzaklığı belirler. +* [`type`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#type): String. [Girdi tipleri](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types)'nden biridir. +* [`width`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#width): String. Tipi `type="image"` olan girdiler için görsel genişliğini belirler. + +#### Uyarılar {/*caveats*/} + +- Onay kutularının `value` (veya`defaultValue`) yerine`checked` (veya `defaultChecked`) değerine ihtiyacı vardır. +- Metin girdisi `value` propuna string değer alırsa [kontrollü bileşen](#controlling-an-input-with-a-state-variable) olarak ele alınır. +- Onay kutusu ya da radyo butonu `checked` propuna boolean değer alırsa [kontrollü bileşen](#controlling-an-input-with-a-state-variable) olarak ele alınır. +- Bir girdi aynı anda hem kontrollü hem de kontrolsüz olamaz. +- Bir girdi yaşam döngüsü boyunca kontrollü ve kontrolsüz olma arasında geçiş yapamaz. +- Kontrollü tüm girdiler, değeri senkronize olarak güncelleyen `onChange` olay yöneticisine ihtiyaç duyar. --- -## Usage {/*usage*/} +## Kullanım {/*usage*/} -### 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) +### Farklı tiplerde girdileri gösterme{/*displaying-inputs-of-different-types*/} +Ekranda ``'u görülemek için render ediniz. Varsayılan olarak metin girdisi olacaktır. Onay kutusu için `type="checkbox"`, radyo butonu için `type="radio"` [veya diğer girdi tiplerinden birini](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types) gönderebilirsiniz. ```js @@ -146,11 +147,11 @@ input { margin: 5px; } --- -### Providing a label for an input {/*providing-a-label-for-an-input*/} +### Girdi için etiket verme {/*providing-a-label-for-an-input*/} -Typically, you will place every `` inside a [`