Skip to content

Commit 4a89860

Browse files
authored
docs(checkbox): add basic playground (#2517)
1 parent 232c082 commit 4a89860

File tree

7 files changed

+98
-1
lines changed

7 files changed

+98
-1
lines changed

docs/api/checkbox.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ Checkboxes allow the selection of multiple options from a set of options. They a
2424

2525
## Basic
2626

27-
TODO Playground
27+
import Basic from '@site/static/usage/checkbox/basic/index.md';
28+
29+
<Basic />
2830

2931
## Indeterminate Checkboxes
3032

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
```html
2+
<ion-item>
3+
<ion-checkbox slot="start"></ion-checkbox>
4+
<ion-label>I agree to the terms and conditions</ion-label>
5+
</ion-item>
6+
```

static/usage/checkbox/basic/demo.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Checkbox</title>
7+
<link rel="stylesheet" href="../../common.css" />
8+
<script src="../../common.js"></script>
9+
<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core@6/dist/ionic/ionic.esm.js"></script>
10+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@6/css/ionic.bundle.css" />
11+
</head>
12+
<body>
13+
<ion-app>
14+
<ion-content>
15+
<div class="container">
16+
<ion-item>
17+
<ion-checkbox slot="start"></ion-checkbox>
18+
<ion-label>I agree to the terms and conditions</ion-label>
19+
</ion-item>
20+
</div>
21+
</ion-content>
22+
</ion-app>
23+
</body>
24+
</html>

static/usage/checkbox/basic/index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Playground from '@site/src/components/global/Playground';
2+
3+
import javascript from './javascript.md';
4+
import react from './react.md';
5+
import vue from './vue.md';
6+
import angular from './angular.md';
7+
8+
<Playground
9+
code={{
10+
javascript,
11+
react,
12+
vue,
13+
angular
14+
}}
15+
src="usage/checkbox/basic/demo.html"
16+
/>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
```html
2+
<ion-item>
3+
<ion-checkbox slot="start"></ion-checkbox>
4+
<ion-label>I agree to the terms and conditions</ion-label>
5+
</ion-item>
6+
```

static/usage/checkbox/basic/react.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
```tsx
2+
import React from 'react';
3+
import {
4+
IonCheckbox,
5+
IonItem,
6+
IonLabel
7+
} from '@ionic/react';
8+
9+
function Example() {
10+
return (
11+
<IonItem>
12+
<IonCheckbox slot="start"></IonCheckbox>
13+
<IonLabel>I agree to the terms and conditions</IonLabel>
14+
</IonItem>
15+
);
16+
}
17+
export default Example;
18+
```

static/usage/checkbox/basic/vue.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
```html
2+
<template>
3+
<ion-item>
4+
<ion-checkbox slot="start"></ion-checkbox>
5+
<ion-label>I agree to the terms and conditions</ion-label>
6+
</ion-item>
7+
</template>
8+
9+
<script lang="ts">
10+
import {
11+
IonCheckbox,
12+
IonItem,
13+
IonLabel
14+
} from '@ionic/vue';
15+
import { defineComponent } from 'vue';
16+
17+
export default defineComponent({
18+
components: {
19+
IonCheckbox,
20+
IonItem,
21+
IonLabel
22+
}
23+
});
24+
</script>
25+
```

0 commit comments

Comments
 (0)