Skip to content

Commit 54c7142

Browse files
docs(react, vue): update Quickstart page to use modern checkbox syntax (#3415)
1 parent 9269385 commit 54c7142

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

docs/react/quickstart.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ When creating your own pages, don't forget to have `IonPage` be the root compone
171171
Our current content is relatively simple but does not contain anything that could be used in a real app, so let's change that.
172172

173173
:::note
174-
For brevity, we're excluding repeating part of our component, like the function declaration or import statements for other components.
174+
For brevity, we're excluding repeating parts of our component, like the function declaration or import statements for other components.
175175
:::
176176

177177
```tsx
@@ -180,11 +180,10 @@ For brevity, we're excluding repeating part of our component, like the function
180180
<IonContent>
181181
<IonList>
182182
<IonItem>
183-
<IonCheckbox slot="start" />
184-
<IonLabel>
183+
<IonCheckbox labelPlacement="end" justify="start">
185184
<h1>Create Idea</h1>
186185
<IonNote>Run Idea by Brandy</IonNote>
187-
</IonLabel>
186+
</IonCheckbox>
188187
<IonBadge color="success" slot="end">
189188
5 Days
190189
</IonBadge>
@@ -198,20 +197,17 @@ Here in our `IonContent`, we're adding an `IonList` and a much more involved `Io
198197

199198
```tsx
200199
<IonItem>
201-
<IonCheckbox slot="start" />
202-
<IonLabel>
200+
<IonCheckbox labelPlacement="end" justify="start">
203201
<h1>Create Idea</h1>
204202
<IonNote>Run Idea by Brandy</IonNote>
205-
</IonLabel>
203+
</IonCheckbox>
206204
<IonBadge color="success" slot="end">
207205
5 Days
208206
</IonBadge>
209207
</IonItem>
210208
```
211209

212-
Item is important as it clearly shows the mix of React concepts and Web Component concepts. The first clear example of a React concept is self-closing tags for React Components in `IonCheckbox`. This is just a simpler way of writing components that do not contain any child content.
213-
214-
From the Web Components side, we have a special attribute called `slot`. This is key for letting the `IonItem` know where to place the `IonCheckbox` when it renders. This is not a React API, but a web standards API.
210+
Looking at our code, we have a special attribute called `slot`. This is key for letting the `IonItem` know where to place the `IonBadge` when it renders. This is not a React API, but a web standards API, and it is used in many Ionic Framework components. (For more information on slots, [see the MDN docs here](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot).)
215211

216212
Let's look at another component from Ionic, FAB. Floating Action Buttons are a nice way to provide a main action that is elevated from the rest of an app. For this FAB, we'll need three components: a FAB, a FAB Button, and an Icon.
217213

docs/vue/quickstart.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,11 @@ For brevity, we are excluding repeating parts of our component, like the functio
282282
<ion-content>
283283
<ion-list>
284284
<ion-item>
285-
<ion-checkbox slot="start"></ion-checkbox>
286-
<ion-label>
285+
<ion-checkbox label-placement="end" justify="start">
287286
<h1>Create Idea</h1>
288287
<ion-note>Run Idea By Brandy</ion-note>
289-
</ion-label>
290-
<ion-badge color="success" slot="end"> 5 Days </ion-badge>
288+
</ion-checkbox>
289+
<ion-badge color="success" slot="end">5 Days</ion-badge>
291290
</ion-item>
292291
</ion-list>
293292
</ion-content>
@@ -301,7 +300,6 @@ For brevity, we are excluding repeating parts of our component, like the functio
301300
IonContent,
302301
IonHeader,
303302
IonItem,
304-
IonLabel,
305303
IonList,
306304
IonNote,
307305
IonPage,
@@ -315,16 +313,15 @@ Here in our `IonContent`, we are adding an `IonList` and a much more involved `I
315313

316314
```html
317315
<ion-item>
318-
<ion-checkbox slot="start"></ion-checkbox>
319-
<ion-label>
316+
<ion-checkbox label-placement="end" justify="start">
320317
<h1>Create Idea</h1>
321318
<ion-note>Run Idea By Brandy</ion-note>
322-
</ion-label>
323-
<ion-badge color="success" slot="end"> 5 Days </ion-badge>
319+
</ion-checkbox>
320+
<ion-badge color="success" slot="end">5 Days</ion-badge>
324321
</ion-item>
325322
```
326323

327-
Looking at our code, we have a special attribute called slot. This is key for letting the `IonItem` know where to place the `IonCheckbox` when it renders. This is not a Vue API, but a web standards API. Additionally, this is different from the slots API you may recall from Vue 2.
324+
Looking at our code, we have a special attribute called `slot`. This is key for letting the `IonItem` know where to place the `IonBadge` when it renders. This is not a Vue API, but a web standards API, and it is used across many Ionic Framework components. Additionally, this is different from the slots API you may recall from Vue 2. (For more information on slots, [see the MDN docs here](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot).)
328325

329326
Let's look at another component from Ionic Framework, FAB. Floating Action Buttons are a nice way to provide a main action that is elevated from the rest of an app. For this FAB, we will need three components: a FAB, a FAB Button, and an Icon.
330327

@@ -353,7 +350,6 @@ Let's look at another component from Ionic Framework, FAB. Floating Action Butto
353350
IonHeader,
354351
IonIcon,
355352
IonItem,
356-
IonLabel,
357353
IonList,
358354
IonNote,
359355
IonPage,

0 commit comments

Comments
 (0)