Skip to content

docs(checkbox): add indeterminate demos #2521

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 3 commits into from
Sep 1, 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 @@ -30,7 +30,9 @@ import Basic from '@site/static/usage/checkbox/basic/index.md';

## Indeterminate Checkboxes

TODO Playground
import Indeterminate from '@site/static/usage/checkbox/indeterminate/index.md';

<Indeterminate />

## Theming

Expand Down
2 changes: 1 addition & 1 deletion src/components/global/Playground/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export default function Playground({
* load, so a loading screen is shown by default.
* Once the source of the iframe loads we can
* hide the loading screen and show the inner content.
*
*
* We call this as a local function because useEffect
* callbacks cannot return a Promise, as async functions do.
*/
Expand Down
6 changes: 6 additions & 0 deletions static/usage/checkbox/indeterminate/angular.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```html
<ion-item>
<ion-checkbox slot="start" [indeterminate]="true"></ion-checkbox>
<ion-label>Indeterminate checkbox</ion-label>
</ion-item>
```
24 changes: 24 additions & 0 deletions static/usage/checkbox/indeterminate/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!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" />
</head>
<body>
<ion-app>
<ion-content>
<div class="container">
<ion-item>
<ion-checkbox slot="start" indeterminate="true"></ion-checkbox>
<ion-label>Indeterminate checkbox</ion-label>
</ion-item>
</div>
</ion-content>
</ion-app>
</body>
</html>
16 changes: 16 additions & 0 deletions static/usage/checkbox/indeterminate/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Playground from '@site/src/components/global/Playground';

import javascript from './javascript.md';
import react from './react.md';
import vue from './vue.md';
import angular from './angular.md';

<Playground
code={{
javascript,
react,
vue,
angular
}}
src="usage/checkbox/indeterminate/demo.html"
/>
6 changes: 6 additions & 0 deletions static/usage/checkbox/indeterminate/javascript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```html
<ion-item>
<ion-checkbox slot="start" indeterminate="true"></ion-checkbox>
<ion-label>Indeterminate checkbox</ion-label>
</ion-item>
```
18 changes: 18 additions & 0 deletions static/usage/checkbox/indeterminate/react.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```tsx
import React from 'react';
import {
IonCheckbox,
IonItem,
IonLabel
} from '@ionic/react';

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