Skip to content

Commit 77af95a

Browse files
authored
docs(checkbox): add theming playground (#2528)
1 parent 168c88f commit 77af95a

File tree

9 files changed

+172
-1
lines changed

9 files changed

+172
-1
lines changed

docs/api/checkbox.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ import Indeterminate from '@site/static/usage/checkbox/indeterminate/index.md';
3636

3737
## Theming
3838

39-
TODO Playground
39+
import Theming from '@site/static/usage/checkbox/theming/index.md';
40+
41+
<Theming />
4042

4143
## Interfaces
4244

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
```css
2+
ion-checkbox {
3+
--size: 32px;
4+
--background-checked: #6815ec;
5+
}
6+
7+
ion-checkbox::part(container) {
8+
border-radius: 6px;
9+
border: 2px solid #6815ec;
10+
}
11+
```
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>Themed checkbox</ion-label>
5+
</ion-item>
6+
```
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
<style>
12+
ion-checkbox {
13+
--size: 32px;
14+
--background-checked: #6815ec;
15+
}
16+
17+
ion-checkbox::part(container) {
18+
border-radius: 6px;
19+
border: 2px solid #6815ec;
20+
}
21+
</style>
22+
</head>
23+
<body>
24+
<ion-app>
25+
<ion-content>
26+
<div class="container">
27+
<ion-item>
28+
<ion-checkbox slot="start"></ion-checkbox>
29+
<ion-label>Themed checkbox</ion-label>
30+
</ion-item>
31+
</div>
32+
</ion-content>
33+
</ion-app>
34+
</body>
35+
</html>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import Playground from '@site/src/components/global/Playground';
2+
3+
import javascript from './javascript.md';
4+
5+
import react_main_tsx from './react/main_tsx.md';
6+
import react_main_css from './react/main_css.md';
7+
8+
import vue from './vue.md';
9+
10+
import angular_example_component_html from './angular/example_component_html.md';
11+
import angular_example_component_css from './angular/example_component_css.md';
12+
13+
<Playground
14+
code={{
15+
javascript,
16+
react: {
17+
files: {
18+
'src/main.tsx': react_main_tsx,
19+
'src/main.css': react_main_css
20+
}
21+
},
22+
vue,
23+
angular: {
24+
files: {
25+
'src/app/example.component.html': angular_example_component_html,
26+
'src/app/example.component.css': angular_example_component_css
27+
}
28+
}
29+
}}
30+
src="usage/checkbox/theming/demo.html"
31+
/>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
```html
2+
<ion-item>
3+
<ion-checkbox slot="start"></ion-checkbox>
4+
<ion-label>Themed checkbox</ion-label>
5+
</ion-item>
6+
7+
<style>
8+
ion-checkbox {
9+
--size: 32px;
10+
--background-checked: #6815ec;
11+
}
12+
13+
ion-checkbox::part(container) {
14+
border-radius: 6px;
15+
border: 2px solid #6815ec;
16+
}
17+
</style>
18+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
```css
2+
ion-checkbox {
3+
--size: 32px;
4+
--background-checked: #6815ec;
5+
}
6+
7+
ion-checkbox::part(container) {
8+
border-radius: 6px;
9+
border: 2px solid #6815ec;
10+
}
11+
```
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
```tsx
2+
import React from 'react';
3+
import {
4+
IonCheckbox,
5+
IonItem,
6+
IonLabel
7+
} from '@ionic/react';
8+
9+
import './main.css';
10+
11+
function Example() {
12+
return (
13+
<IonItem>
14+
<IonCheckbox slot="start"></IonCheckbox>
15+
<IonLabel>Themed checkbox</IonLabel>
16+
</IonItem>
17+
);
18+
}
19+
export default Example;
20+
```

static/usage/checkbox/theming/vue.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
```html
2+
<template>
3+
<ion-item>
4+
<ion-checkbox slot="start"></ion-checkbox>
5+
<ion-label>Themed checkbox</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+
26+
<style>
27+
ion-checkbox {
28+
--size: 32px;
29+
--background-checked: #6815ec;
30+
}
31+
32+
ion-checkbox::part(container) {
33+
border-radius: 6px;
34+
border: 2px solid #6815ec;
35+
}
36+
</style>
37+
```

0 commit comments

Comments
 (0)