You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/reference/react-dom/components/title.md
+26-27Lines changed: 26 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,10 @@ title: "<title>"
4
4
5
5
<Intro>
6
6
7
-
The [built-in browser `<title>`component](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title)lets you specify the title of the document.
7
+
O [componente `<title>`do navegador incorporado](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title)permite que você especifique o título do documento.
8
8
9
9
```js
10
-
<title>My Blog</title>
10
+
<title>Meu Blog</title>
11
11
```
12
12
13
13
</Intro>
@@ -16,45 +16,45 @@ The [built-in browser `<title>` component](https://developer.mozilla.org/en-US/d
16
16
17
17
---
18
18
19
-
## Reference {/*reference*/}
19
+
## Referência {/*reference*/}
20
20
21
21
### `<title>` {/*title*/}
22
22
23
-
To specify the title of the document, render the [built-in browser `<title>`component](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title). You can render `<title>`from any component and React will always place the corresponding DOM element in the document head.
23
+
Para especificar o título do documento, renderize o [componente `<title>`de navegador incorporado](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title). Você pode renderizar o `<title>`de qualquer componente, e o React sempre colocará o elemento DOM correspondente no head do documento.
24
24
25
25
```js
26
-
<title>My Blog</title>
26
+
<title>Meu Blog</title>
27
27
```
28
28
29
-
[See more examples below.](#usage)
29
+
[Veja mais exemplos abaixo.](#usage)
30
30
31
31
#### Props {/*props*/}
32
32
33
-
`<title>`supports all [common element props.](/reference/react-dom/components/common#props)
33
+
`<title>`suporta todas as [props de elementos comuns.](/reference/react-dom/components/common#props)
34
34
35
-
*`children`: `<title>`accepts only text as a child. This text will become the title of the document. You can also pass your own components as long as they only render text.
35
+
*`children`: `<title>`aceita apenas texto como um filho. Este texto se tornará o título do documento. Você também pode passar seus próprios componentes desde que eles renderizem apenas texto.
36
36
37
-
#### Special rendering behavior {/*special-rendering-behavior*/}
37
+
#### Comportamento de renderização especial {/*special-rendering-behavior*/}
38
38
39
-
React will always place the DOM element corresponding to the `<title>`component within the document’s `<head>`, regardless of where in the React tree it is rendered. The`<head>`is the only valid place for`<title>`to exist within the DOM, yet it’s convenient and keeps things composable if a component representing a specific page can render its `<title>` itself.
39
+
O React sempre colocará o elemento DOM correspondente ao componente `<title>`dentro do `<head>` do documento, independentemente de onde na árvore React ele for renderizado. O`<head>`é o único lugar válido para`<title>`existir dentro do DOM, mas é conveniente e mantém as coisas compostas se um componente representando uma página específica pode renderizar seu próprio `<title>`.
40
40
41
-
There are two exception to this:
42
-
*If`<title>`is within an `<svg>` component, then there is no special behavior, because in this context it doesn’t represent the document’s title but rather is an [accessibility annotation for that SVG graphic](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title).
43
-
*If the`<title>`has an [`itemProp`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemprop) prop, there is no special behavior, because in this case it doesn’t represent the document’s title but rather metadata about a specific part of the page.
41
+
Há duas exceções a isso:
42
+
*Se`<title>`estiver dentro de um componente `<svg>`, então não há comportamento especial, porque nesse contexto ele não representa o título do documento, mas sim uma [anotação de acessibilidade para esse gráfico SVG](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title).
43
+
*Se o`<title>`tiver uma prop [`itemProp`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/itemprop), não há comportamento especial, porque nesse caso ele não representa o título do documento, mas sim metadados sobre uma parte específica da página.
44
44
45
45
<Pitfall>
46
46
47
-
Only render a single `<title>`at a time. If more than one component renders a `<title>`tag at the same time, React will place all of those titles in the document head. When this happens, the behavior of browsers and search engines is undefined.
47
+
Renderize apenas um `<title>`por vez. Se mais de um componente renderizar uma tag `<title>`ao mesmo tempo, o React colocará todos esses títulos no head do documento. Quando isso acontece, o comportamento dos navegadores e mecanismos de busca fica indefinido.
48
48
49
49
</Pitfall>
50
50
51
51
---
52
52
53
-
## Usage {/*usage*/}
53
+
## Uso {/*usage*/}
54
54
55
-
### Set the document title {/*set-the-document-title*/}
55
+
### Definir o título do documento {/*set-the-document-title*/}
56
56
57
-
Render the `<title>`component from any component with text as its children. React will put a `<title>`DOM node in the document `<head>`.
57
+
Renderize o componente `<title>`de qualquer componente com texto como seus filhos. O React colocará um nó DOM `<title>`no `<head>` do documento.
58
58
59
59
<SandpackWithHTMLOutput>
60
60
@@ -64,27 +64,26 @@ import ShowRenderedHTML from './ShowRenderedHTML.js';
64
64
exportdefaultfunctionContactUsPage() {
65
65
return (
66
66
<ShowRenderedHTML>
67
-
<title>My Site:Contact Us</title>
68
-
<h1>Contact Us</h1>
69
-
<p>Email us at support@example.com</p>
67
+
<title>Meu Site:Fale Conosco</title>
68
+
<h1>Fale Conosco</h1>
69
+
<p>Envie um e-mail para support@example.com</p>
70
70
</ShowRenderedHTML>
71
71
);
72
72
}
73
73
```
74
74
75
75
</SandpackWithHTMLOutput>
76
76
77
-
### Use variables in the title {/*use-variables-in-the-title*/}
77
+
### Use variáveis no título {/*use-variables-in-the-title*/}
78
78
79
-
The children of the`<title>`component must be a single string of text. (Or a single number or a single object with a `toString` method.) It might not be obvious, but using JSX curly braces like this:
79
+
Os filhos do componente`<title>`devem ser uma única string de texto. (Ou um único número ou um único objeto com um método `toString`.) Pode não ser óbvio, mas usar chaves JSX assim:
80
80
81
81
```js
82
-
<title>Results page {pageNumber}</title>// 🔴 Problem: This is not a single string
82
+
<title>Página de resultados {pageNumber}</title>// 🔴 Problema: Isso não é uma única string
83
83
```
84
84
85
-
... actually causes the `<title>`component to get a two-element array as its children (the string `"Results page"`and the value of`pageNumber`). This will cause an error. Instead, use string interpolation to pass`<title>`a single string:
85
+
... na verdade, faz com que o componente `<title>`receba um array de dois elementos como seus filhos (a string `"Página de resultados"`e o valor de`pageNumber`). Isso causará um erro. Em vez disso, use a interpolação de string para passar ao`<title>`uma única string:
86
86
87
87
```js
88
-
<title>{`Results page ${pageNumber}`}</title>
89
-
```
90
-
88
+
<title>{`Página de resultados ${pageNumber}`}</title>
0 commit comments