Skip to content

docs(checkbox): add theming playground #2528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/api/checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ import Indeterminate from '@site/static/usage/checkbox/indeterminate/index.md';

## Theming

TODO Playground
import Theming from '@site/static/usage/checkbox/theming/index.md';

<Theming />

## Interfaces

Expand Down
11 changes: 11 additions & 0 deletions static/usage/checkbox/theming/angular/example_component_css.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```css
ion-checkbox {
--size: 32px;
--background-checked: #6815ec;
}

ion-checkbox::part(container) {
border-radius: 6px;
border: 2px solid #6815ec;
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```html
<ion-item>
<ion-checkbox slot="start"></ion-checkbox>
<ion-label>Themed checkbox</ion-label>
</ion-item>
```
35 changes: 35 additions & 0 deletions static/usage/checkbox/theming/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Checkbox</title>
<link rel="stylesheet" href="../../common.css" />
<script src="../../common.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core@6/dist/ionic/ionic.esm.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@6/css/ionic.bundle.css" />
<style>
ion-checkbox {
--size: 32px;
--background-checked: #6815ec;
}

ion-checkbox::part(container) {
border-radius: 6px;
border: 2px solid #6815ec;
}
</style>
</head>
<body>
<ion-app>
<ion-content>
<div class="container">
<ion-item>
<ion-checkbox slot="start"></ion-checkbox>
<ion-label>Themed checkbox</ion-label>
</ion-item>
</div>
</ion-content>
</ion-app>
</body>
</html>
31 changes: 31 additions & 0 deletions static/usage/checkbox/theming/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Playground from '@site/src/components/global/Playground';

import javascript from './javascript.md';

import react_main_tsx from './react/main_tsx.md';
import react_main_css from './react/main_css.md';

import vue from './vue.md';

import angular_example_component_html from './angular/example_component_html.md';
import angular_example_component_css from './angular/example_component_css.md';

<Playground
code={{
javascript,
react: {
files: {
'src/main.tsx': react_main_tsx,
'src/main.css': react_main_css
}
},
vue,
angular: {
files: {
'src/app/example.component.html': angular_example_component_html,
'src/app/example.component.css': angular_example_component_css
}
}
}}
src="usage/checkbox/theming/demo.html"
/>
18 changes: 18 additions & 0 deletions static/usage/checkbox/theming/javascript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```html
<ion-item>
<ion-checkbox slot="start"></ion-checkbox>
<ion-label>Themed checkbox</ion-label>
</ion-item>

<style>
ion-checkbox {
--size: 32px;
--background-checked: #6815ec;
}

ion-checkbox::part(container) {
border-radius: 6px;
border: 2px solid #6815ec;
}
</style>
```
11 changes: 11 additions & 0 deletions static/usage/checkbox/theming/react/main_css.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```css
ion-checkbox {
--size: 32px;
--background-checked: #6815ec;
}

ion-checkbox::part(container) {
border-radius: 6px;
border: 2px solid #6815ec;
}
```
20 changes: 20 additions & 0 deletions static/usage/checkbox/theming/react/main_tsx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
```tsx
import React from 'react';
import {
IonCheckbox,
IonItem,
IonLabel
} from '@ionic/react';

import './main.css';

function Example() {
return (
<IonItem>
<IonCheckbox slot="start"></IonCheckbox>
<IonLabel>Themed checkbox</IonLabel>
</IonItem>
);
}
export default Example;
```
37 changes: 37 additions & 0 deletions static/usage/checkbox/theming/vue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
```html
<template>
<ion-item>
<ion-checkbox slot="start"></ion-checkbox>
<ion-label>Themed checkbox</ion-label>
</ion-item>
</template>

<script lang="ts">
import {
IonCheckbox,
IonItem,
IonLabel
} from '@ionic/vue';
import { defineComponent } from 'vue';

export default defineComponent({
components: {
IonCheckbox,
IonItem,
IonLabel
}
});
</script>

<style>
ion-checkbox {
--size: 32px;
--background-checked: #6815ec;
}

ion-checkbox::part(container) {
border-radius: 6px;
border: 2px solid #6815ec;
}
</style>
```