diff --git a/core/src/components/action-sheet/readme.md b/core/src/components/action-sheet/readme.md index cc808f9d0f..1be4437998 100644 --- a/core/src/components/action-sheet/readme.md +++ b/core/src/components/action-sheet/readme.md @@ -123,6 +123,73 @@ async function presentActionSheet() { ``` +### React + +```typescript +import React, { Component } from 'react' +import { IonActionSheet } from '@ionic/react'; + +type Props = {} +type State = { + showActionSheet: boolean +} + +export default class ActionSheetExample extends Component { + + constructor(props: Props) { + super(props); + this.state = { + showActionSheet: false + }; + } + + render() { + return ( + this.setState(() => ({ showActionSheet: false }))} + buttons={[{ + text: 'Delete', + role: 'destructive', + icon: 'trash', + handler: () => { + console.log('Delete clicked'); + } + }, { + text: 'Share', + icon: 'share', + handler: () => { + console.log('Share clicked'); + } + }, { + text: 'Play (open modal)', + icon: 'arrow-dropright-circle', + handler: () => { + console.log('Play clicked'); + } + }, { + text: 'Favorite', + icon: 'heart', + handler: () => { + console.log('Favorite clicked'); + } + }, { + text: 'Cancel', + icon: 'close', + role: 'cancel', + handler: () => { + console.log('Cancel clicked'); + } + }]} + > + + ); + } +} + +``` + + ## Properties diff --git a/core/src/components/action-sheet/usage/react.md b/core/src/components/action-sheet/usage/react.md new file mode 100644 index 0000000000..f4643fdba6 --- /dev/null +++ b/core/src/components/action-sheet/usage/react.md @@ -0,0 +1,63 @@ +```typescript +import React, { Component } from 'react' +import { IonActionSheet } from '@ionic/react'; + +type Props = {} +type State = { + showActionSheet: boolean +} + +export default class ActionSheetExample extends Component { + + constructor(props: Props) { + super(props); + this.state = { + showActionSheet: false + }; + } + + render() { + return ( + this.setState(() => ({ showActionSheet: false }))} + buttons={[{ + text: 'Delete', + role: 'destructive', + icon: 'trash', + handler: () => { + console.log('Delete clicked'); + } + }, { + text: 'Share', + icon: 'share', + handler: () => { + console.log('Share clicked'); + } + }, { + text: 'Play (open modal)', + icon: 'arrow-dropright-circle', + handler: () => { + console.log('Play clicked'); + } + }, { + text: 'Favorite', + icon: 'heart', + handler: () => { + console.log('Favorite clicked'); + } + }, { + text: 'Cancel', + icon: 'close', + role: 'cancel', + handler: () => { + console.log('Cancel clicked'); + } + }]} + > + + ); + } +} + +``` diff --git a/core/src/components/alert/readme.md b/core/src/components/alert/readme.md index e3dd4d4a8a..788a357318 100644 --- a/core/src/components/alert/readme.md +++ b/core/src/components/alert/readme.md @@ -526,6 +526,281 @@ async function presentAlertCheckbox() { ``` +### React + +```tsx +import React, { Component } from 'react' +import { IonAlert } from '@ionic/react'; + +type Props = {} +type State = { + showAlert1: boolean + showAlert2: boolean + showAlert3: boolean + showAlert4: boolean + showAlert5: boolean + showAlert6: boolean +} + +export default class AlertExample extends Component { + + constructor(props: Props) { + super(props); + this.state = { + showAlert1: false + showAlert2: false + showAlert3: false + showAlert4: false + showAlert5: false + showAlert6: false + }; + } + + render() { + return ( + this.setState(() => ({ showAlert1: false }))} + header={'Alert'} + subHeader={'Subtitle'} + message={'This is an alert message.'} + buttons={['OK']} + > + + + + this.setState(() => ({ showAlert2: false }))} + header={'Alert'} + subHeader={'Subtitle'} + message={'This is an alert message.'} + buttons={['Cancel', 'Open Modal', 'Delete']} + > + + + + this.setState(() => ({ showAlert3: false }))} + header={'Confirm!'} + message={'Message text!!!'} + buttons={[ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: (blah) => { + console.log('Confirm Cancel: blah'); + } + }, { + text: 'Okay', + handler: () => { + console.log('Confirm Okay'); + } + } + ]} + > + + + + this.setState(() => ({ showAlert4: false }))} + header={'Prompt!'} + inputs={[ + { + name: 'name1', + type: 'text', + placeholder: 'Placeholder 1' + }, + { + name: 'name2', + type: 'text', + id: 'name2-id', + value: 'hello', + placeholder: 'Placeholder 2' + }, + { + name: 'name3', + value: 'http://ionicframework.com', + type: 'url', + placeholder: 'Favorite site ever' + }, + // input date with min & max + { + name: 'name4', + type: 'date', + min: '2017-03-01', + max: '2018-01-12' + }, + // input date without min nor max + { + name: 'name5', + type: 'date' + }, + { + name: 'name6', + type: 'number', + min: -5, + max: 10 + }, + { + name: 'name7', + type: 'number' + } + ]} + buttons={[ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: () => { + console.log('Confirm Cancel'); + } + }, { + text: 'Ok', + handler: () => { + console.log('Confirm Ok'); + } + } + ]} + > + + + + + + this.setState(() => ({ showAlert5: false }))} + header={'Radio'} + inputs={[ + { + name: 'radio1', + type: 'radio', + label: 'Radio 1', + value: 'value1', + checked: true + }, + { + name: 'radio2', + type: 'radio', + label: 'Radio 2', + value: 'value2' + }, + { + name: 'radio3', + type: 'radio', + label: 'Radio 3', + value: 'value3' + }, + { + name: 'radio4', + type: 'radio', + label: 'Radio 4', + value: 'value4' + }, + { + name: 'radio5', + type: 'radio', + label: 'Radio 5', + value: 'value5' + }, + { + name: 'radio6', + type: 'radio', + label: 'Radio 6', + value: 'value6' + } + ]} + buttons={[ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: () => { + console.log('Confirm Cancel'); + } + }, { + text: 'Ok', + handler: () => { + console.log('Confirm Ok'); + } + } + ]} + > + + + + + this.setState(() => ({ showAlert6: false }))} + header={'Checkbox'} + inputs={[ + { + name: 'checkbox1', + type: 'checkbox', + label: 'Checkbox 1', + value: 'value1', + checked: true + }, + { + name: 'checkbox2', + type: 'checkbox', + label: 'Checkbox 2', + value: 'value2' + }, + { + name: 'checkbox3', + type: 'checkbox', + label: 'Checkbox 3', + value: 'value3' + }, + { + name: 'checkbox4', + type: 'checkbox', + label: 'Checkbox 4', + value: 'value4' + }, + { + name: 'checkbox5', + type: 'checkbox', + label: 'Checkbox 5', + value: 'value5' + }, + { + name: 'checkbox6', + type: 'checkbox', + label: 'Checkbox 6', + value: 'value6' + } + ]} + buttons={[ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: () => { + console.log('Confirm Cancel'); + } + }, { + text: 'Ok', + handler: () => { + console.log('Confirm Ok'); + } + } + ]} + > + + ); + } +} + +``` + + ## Properties diff --git a/core/src/components/alert/usage/react.md b/core/src/components/alert/usage/react.md new file mode 100644 index 0000000000..81baa70067 --- /dev/null +++ b/core/src/components/alert/usage/react.md @@ -0,0 +1,271 @@ +```tsx +import React, { Component } from 'react' +import { IonAlert } from '@ionic/react'; + +type Props = {} +type State = { + showAlert1: boolean + showAlert2: boolean + showAlert3: boolean + showAlert4: boolean + showAlert5: boolean + showAlert6: boolean +} + +export default class AlertExample extends Component { + + constructor(props: Props) { + super(props); + this.state = { + showAlert1: false + showAlert2: false + showAlert3: false + showAlert4: false + showAlert5: false + showAlert6: false + }; + } + + render() { + return ( + this.setState(() => ({ showAlert1: false }))} + header={'Alert'} + subHeader={'Subtitle'} + message={'This is an alert message.'} + buttons={['OK']} + > + + + + this.setState(() => ({ showAlert2: false }))} + header={'Alert'} + subHeader={'Subtitle'} + message={'This is an alert message.'} + buttons={['Cancel', 'Open Modal', 'Delete']} + > + + + + this.setState(() => ({ showAlert3: false }))} + header={'Confirm!'} + message={'Message text!!!'} + buttons={[ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: (blah) => { + console.log('Confirm Cancel: blah'); + } + }, { + text: 'Okay', + handler: () => { + console.log('Confirm Okay'); + } + } + ]} + > + + + + this.setState(() => ({ showAlert4: false }))} + header={'Prompt!'} + inputs={[ + { + name: 'name1', + type: 'text', + placeholder: 'Placeholder 1' + }, + { + name: 'name2', + type: 'text', + id: 'name2-id', + value: 'hello', + placeholder: 'Placeholder 2' + }, + { + name: 'name3', + value: 'http://ionicframework.com', + type: 'url', + placeholder: 'Favorite site ever' + }, + // input date with min & max + { + name: 'name4', + type: 'date', + min: '2017-03-01', + max: '2018-01-12' + }, + // input date without min nor max + { + name: 'name5', + type: 'date' + }, + { + name: 'name6', + type: 'number', + min: -5, + max: 10 + }, + { + name: 'name7', + type: 'number' + } + ]} + buttons={[ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: () => { + console.log('Confirm Cancel'); + } + }, { + text: 'Ok', + handler: () => { + console.log('Confirm Ok'); + } + } + ]} + > + + + + + + this.setState(() => ({ showAlert5: false }))} + header={'Radio'} + inputs={[ + { + name: 'radio1', + type: 'radio', + label: 'Radio 1', + value: 'value1', + checked: true + }, + { + name: 'radio2', + type: 'radio', + label: 'Radio 2', + value: 'value2' + }, + { + name: 'radio3', + type: 'radio', + label: 'Radio 3', + value: 'value3' + }, + { + name: 'radio4', + type: 'radio', + label: 'Radio 4', + value: 'value4' + }, + { + name: 'radio5', + type: 'radio', + label: 'Radio 5', + value: 'value5' + }, + { + name: 'radio6', + type: 'radio', + label: 'Radio 6', + value: 'value6' + } + ]} + buttons={[ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: () => { + console.log('Confirm Cancel'); + } + }, { + text: 'Ok', + handler: () => { + console.log('Confirm Ok'); + } + } + ]} + > + + + + + this.setState(() => ({ showAlert6: false }))} + header={'Checkbox'} + inputs={[ + { + name: 'checkbox1', + type: 'checkbox', + label: 'Checkbox 1', + value: 'value1', + checked: true + }, + { + name: 'checkbox2', + type: 'checkbox', + label: 'Checkbox 2', + value: 'value2' + }, + { + name: 'checkbox3', + type: 'checkbox', + label: 'Checkbox 3', + value: 'value3' + }, + { + name: 'checkbox4', + type: 'checkbox', + label: 'Checkbox 4', + value: 'value4' + }, + { + name: 'checkbox5', + type: 'checkbox', + label: 'Checkbox 5', + value: 'value5' + }, + { + name: 'checkbox6', + type: 'checkbox', + label: 'Checkbox 6', + value: 'value6' + } + ]} + buttons={[ + { + text: 'Cancel', + role: 'cancel', + cssClass: 'secondary', + handler: () => { + console.log('Confirm Cancel'); + } + }, { + text: 'Ok', + handler: () => { + console.log('Confirm Ok'); + } + } + ]} + > + + ); + } +} + +``` diff --git a/core/src/components/avatar/readme.md b/core/src/components/avatar/readme.md index bfffbc4ee2..755936b9d1 100644 --- a/core/src/components/avatar/readme.md +++ b/core/src/components/avatar/readme.md @@ -33,6 +33,38 @@ Avatars can be used by themselves or inside of any element. If placed inside of ``` +### React + +```tsx +import React from 'react' +import { IonAvatar, IonChip, IonItem, IonLabel } from '@ionic/react'; + +const AvatarExample: React.SFC<{}> = () => ( + <> + + + + + + + + + Chip Avatar + + + + + + + Item Avatar + + +); + +export default AvatarExample; +``` + + ## CSS Custom Properties diff --git a/core/src/components/avatar/usage/react.md b/core/src/components/avatar/usage/react.md new file mode 100644 index 0000000000..0d28e47068 --- /dev/null +++ b/core/src/components/avatar/usage/react.md @@ -0,0 +1,28 @@ +```tsx +import React from 'react' +import { IonAvatar, IonChip, IonItem, IonLabel } from '@ionic/react'; + +const AvatarExample: React.SFC<{}> = () => ( + <> + + + + + + + + + Chip Avatar + + + + + + + Item Avatar + + +); + +export default AvatarExample; +``` \ No newline at end of file diff --git a/core/src/components/back-button/readme.md b/core/src/components/back-button/readme.md index 0864b10825..acc03dba5b 100644 --- a/core/src/components/back-button/readme.md +++ b/core/src/components/back-button/readme.md @@ -115,6 +115,71 @@ To change what is displayed in the back button, use the `text` and `icon` proper ``` +### React + +```tsx +import React from 'react'; + +import { IonBackButton, IonHeader, IonToolbar, IonButtons, IonMenuButton } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default back button --*/} + + + + {}} /> + + + + + {/*-- Back button with a default href --*/} + + + + {}} defaultHref="home" /> + + + + + {/*-- Back button with custom text and icon --*/} + + + + {}} + text="buttonText" + icon="buttonIcon" + /> + + + + + {/*-- Back button with no text and custom icon --*/} + + + + {}} text="" icon="add" /> + + + + + {/*-- Danger back button next to a menu button --*/} + + + + + {}} color="danger" /> + + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/back-button/usage/react.md b/core/src/components/back-button/usage/react.md new file mode 100644 index 0000000000..c80a4c67e8 --- /dev/null +++ b/core/src/components/back-button/usage/react.md @@ -0,0 +1,61 @@ +```tsx +import React from 'react'; + +import { IonBackButton, IonHeader, IonToolbar, IonButtons, IonMenuButton } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default back button --*/} + + + + {}} /> + + + + + {/*-- Back button with a default href --*/} + + + + {}} defaultHref="home" /> + + + + + {/*-- Back button with custom text and icon --*/} + + + + {}} + text="buttonText" + icon="buttonIcon" + /> + + + + + {/*-- Back button with no text and custom icon --*/} + + + + {}} text="" icon="add" /> + + + + + {/*-- Danger back button next to a menu button --*/} + + + + + {}} color="danger" /> + + + + +); + +export default Example; +``` \ No newline at end of file diff --git a/core/src/components/backdrop/readme.md b/core/src/components/backdrop/readme.md index 684f23b5d9..85e770afd8 100644 --- a/core/src/components/backdrop/readme.md +++ b/core/src/components/backdrop/readme.md @@ -74,6 +74,39 @@ backdrop.stopPropagation = false; ``` +### React + +```tsx +import React from 'react'; + +import { IonBackdrop } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default backdrop --*/} + + + {/*-- Backdrop that is not tappable --*/} + + + {/*-- Backdrop that is not visible --*/} + + + {/*-- Backdrop with propagation --*/} + + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/backdrop/usage/react.md b/core/src/components/backdrop/usage/react.md new file mode 100644 index 0000000000..db8b7f5f41 --- /dev/null +++ b/core/src/components/backdrop/usage/react.md @@ -0,0 +1,29 @@ +```tsx +import React from 'react'; + +import { IonBackdrop } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default backdrop --*/} + + + {/*-- Backdrop that is not tappable --*/} + + + {/*-- Backdrop that is not visible --*/} + + + {/*-- Backdrop with propagation --*/} + + + + +); + +export default Example; +``` diff --git a/core/src/components/badge/readme.md b/core/src/components/badge/readme.md index 3995d9d096..9ac9a1bf6c 100644 --- a/core/src/components/badge/readme.md +++ b/core/src/components/badge/readme.md @@ -34,6 +34,42 @@ Badges are inline block elements that usually appear near another element. Typic ``` +### React + +```tsx +import React from 'react'; + +import { IonBadge, IonItem, IonLabel } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default --*/} + 99 + + {/*-- Colors --*/} + 11 + 22 + 33 + 44 + 55 + 66 + 77 + 88 + 99 + + {/*-- Item with badge on left and right --*/} + + 11 + My Item + 22 + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/badge/usage/react.md b/core/src/components/badge/usage/react.md new file mode 100644 index 0000000000..6539730df6 --- /dev/null +++ b/core/src/components/badge/usage/react.md @@ -0,0 +1,32 @@ +```tsx +import React from 'react'; + +import { IonBadge, IonItem, IonLabel } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default --*/} + 99 + + {/*-- Colors --*/} + 11 + 22 + 33 + 44 + 55 + 66 + 77 + 88 + 99 + + {/*-- Item with badge on left and right --*/} + + 11 + My Item + 22 + + +); + +export default Example; +``` diff --git a/core/src/components/button/readme.md b/core/src/components/button/readme.md index 33fc3591f6..09a54595c3 100644 --- a/core/src/components/button/readme.md +++ b/core/src/components/button/readme.md @@ -91,6 +91,70 @@ This attribute specifies the size of the button. Setting this attribute will cha ``` +### React + +```tsx +import React from 'react'; + +import { IonButton, IonIcon } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default --*/} + Default + + {/*-- Anchor --*/} + Anchor + + {/*-- Colors --*/} + Primary + Secondary + Tertiary + Success + Warning + Danger + Light + Medium + Dark + + {/*-- Expand --*/} + Full Button + Block Button + + {/*-- Round --*/} + Round Button + + {/*-- Fill --*/} + Outline + Full + Outline + Block + Outline + Round + + {/*-- Icons --*/} + + + Left Icon + + + + Right Icon + + + + + + + + {/*-- Sizes --*/} + Large + Default + Small + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/button/usage/react.md b/core/src/components/button/usage/react.md new file mode 100644 index 0000000000..ebb20a9cb7 --- /dev/null +++ b/core/src/components/button/usage/react.md @@ -0,0 +1,60 @@ +```tsx +import React from 'react'; + +import { IonButton, IonIcon } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default --*/} + Default + + {/*-- Anchor --*/} + Anchor + + {/*-- Colors --*/} + Primary + Secondary + Tertiary + Success + Warning + Danger + Light + Medium + Dark + + {/*-- Expand --*/} + Full Button + Block Button + + {/*-- Round --*/} + Round Button + + {/*-- Fill --*/} + Outline + Full + Outline + Block + Outline + Round + + {/*-- Icons --*/} + + + Left Icon + + + + Right Icon + + + + + + + + {/*-- Sizes --*/} + Large + Default + Small + +); + +export default Example; +``` diff --git a/core/src/components/buttons/readme.md b/core/src/components/buttons/readme.md index 675505e594..a444d7674c 100644 --- a/core/src/components/buttons/readme.md +++ b/core/src/components/buttons/readme.md @@ -103,6 +103,56 @@ The `` element can be positioned inside of the toolbar using a name ``` +### React + +```tsx +import React from 'react'; + +import { IonButtons, IonToolbar, IonBackButton, IonTitle, IonButton, IonIcon, IonMenuButton } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + {}} /> + + Back Button + + + + + + + + /> + + + + Default Buttons + + /> + + + + + + + + {}}> + + + + Right side menu toggle + + + + + +); + +export default Example; + + ---------------------------------------------- diff --git a/core/src/components/buttons/usage/react.md b/core/src/components/buttons/usage/react.md new file mode 100644 index 0000000000..421b8a91b8 --- /dev/null +++ b/core/src/components/buttons/usage/react.md @@ -0,0 +1,46 @@ +```tsx +import React from 'react'; + +import { IonButtons, IonToolbar, IonBackButton, IonTitle, IonButton, IonIcon, IonMenuButton } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + {}} /> + + Back Button + + + + + + + + /> + + + + Default Buttons + + /> + + + + + + + + {}}> + + + + Right side menu toggle + + + + + +); + +export default Example; diff --git a/core/src/components/card/readme.md b/core/src/components/card/readme.md index 2e84bfb69e..0a87e7dcce 100644 --- a/core/src/components/card/readme.md +++ b/core/src/components/card/readme.md @@ -63,6 +63,68 @@ sub-components to reflect this. Please see `ion-card-content`, ``` +### React + +```tsx +import React from 'react'; + +import { IonCard, IonCardHeader, IonCardSubtitle, IonCardTitle, IonCardContent, IonItem, IonIcon, IonLabel, IonButton } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + Card Subtitle + Card Title + + + + Keep close to Nature's heart... and break clear away, once in awhile, + and climb a mountain or spend a week in the woods. Wash your spirit clean. + + + + + + + ion-item in a card, icon left, button right + View + + + + This is content, without any paragraph or header tags, + within an ion-cardContent element. + + + + + + + Card Link Item 1 .activated + + + + + Card Link Item 2 + + + + + Card Button Item 1 .activated + + + + + Card Button Item 2 + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/card/usage/react.md b/core/src/components/card/usage/react.md new file mode 100644 index 0000000000..b27cda8f35 --- /dev/null +++ b/core/src/components/card/usage/react.md @@ -0,0 +1,58 @@ +```tsx +import React from 'react'; + +import { IonCard, IonCardHeader, IonCardSubtitle, IonCardTitle, IonCardContent, IonItem, IonIcon, IonLabel, IonButton } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + Card Subtitle + Card Title + + + + Keep close to Nature's heart... and break clear away, once in awhile, + and climb a mountain or spend a week in the woods. Wash your spirit clean. + + + + + + + ion-item in a card, icon left, button right + View + + + + This is content, without any paragraph or header tags, + within an ion-cardContent element. + + + + + + + Card Link Item 1 .activated + + + + + Card Link Item 2 + + + + + Card Button Item 1 .activated + + + + + Card Button Item 2 + + + +); + +export default Example; +``` diff --git a/core/src/components/checkbox/readme.md b/core/src/components/checkbox/readme.md index 502bdac6c3..d5a9960b6f 100644 --- a/core/src/components/checkbox/readme.md +++ b/core/src/components/checkbox/readme.md @@ -95,6 +95,52 @@ export class HomePage { ``` +### React + +```tsx +import React from 'react'; + +import { IonCheckbox, IonList, IonItem, IonLabel } from '@ionic/react'; + +const form = [ + { val: 'Pepperoni', isChecked: true }, + { val: 'Sausage', isChecked: false }, + { val: 'Mushroom', isChecked: false } +]; + +const CheckboxExample: React.SFC<{}> = () => ( + <> + {/*-- Default Checkbox --*/} + + + {/*-- Disabled Checkbox --*/} + + + {/*-- Checked Checkbox --*/} + + + {/*-- Checkbox Colors --*/} + + + + + + + {/*-- Checkboxes in a List --*/} + + { form.map(({val, isChecked}) => ( + + {{val}} + + + )) } + + +); + +export default CheckboxExample; + + ## Properties diff --git a/core/src/components/checkbox/usage/react.md b/core/src/components/checkbox/usage/react.md new file mode 100644 index 0000000000..0041c36107 --- /dev/null +++ b/core/src/components/checkbox/usage/react.md @@ -0,0 +1,43 @@ +```tsx +import React from 'react'; + +import { IonCheckbox, IonList, IonItem, IonLabel } from '@ionic/react'; + +const form = [ + { val: 'Pepperoni', isChecked: true }, + { val: 'Sausage', isChecked: false }, + { val: 'Mushroom', isChecked: false } +]; + +const CheckboxExample: React.SFC<{}> = () => ( + <> + {/*-- Default Checkbox --*/} + + + {/*-- Disabled Checkbox --*/} + + + {/*-- Checked Checkbox --*/} + + + {/*-- Checkbox Colors --*/} + + + + + + + {/*-- Checkboxes in a List --*/} + + { form.map(({val, isChecked}) => ( + + {{val}} + + + )) } + + +); + +export default CheckboxExample; + diff --git a/core/src/components/chip/readme.md b/core/src/components/chip/readme.md index a786897c77..0a54520447 100644 --- a/core/src/components/chip/readme.md +++ b/core/src/components/chip/readme.md @@ -53,6 +53,61 @@ Chips represent complex entities in small blocks, such as a contact. A chip can ``` +### React + +```tsx +import React from 'react'; + +import { IonChip, IonLabel, IonIcon, IonAvatar } from '@ionic/react'; + +const ChipExample: React.SFC<{}> = () => ( + <> + + Default + + + + Secondary Label + + + + Secondary w/ Dark label + + + + + Default + + + + + Default + + + + Button Chip + + + + + + Icon Chip + + + + + + + + Avatar Chip + + + +); + +export default ChipExample; + + ## Properties diff --git a/core/src/components/chip/usage/react.md b/core/src/components/chip/usage/react.md new file mode 100644 index 0000000000..e6b89da8a5 --- /dev/null +++ b/core/src/components/chip/usage/react.md @@ -0,0 +1,51 @@ +```tsx +import React from 'react'; + +import { IonChip, IonLabel, IonIcon, IonAvatar } from '@ionic/react'; + +const ChipExample: React.SFC<{}> = () => ( + <> + + Default + + + + Secondary Label + + + + Secondary w/ Dark label + + + + + Default + + + + + Default + + + + Button Chip + + + + + + Icon Chip + + + + + + + + Avatar Chip + + + +); + +export default ChipExample; diff --git a/core/src/components/content/readme.md b/core/src/components/content/readme.md index d122cf6735..02549e5428 100644 --- a/core/src/components/content/readme.md +++ b/core/src/components/content/readme.md @@ -36,6 +36,26 @@ content.addEventListener('ionScrollEnd', () => console.log('scroll end')); ``` +### React + +```tsx +import React from 'react'; + +import { IonContent } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + {}} + onIonScroll={() => {}} + onIonScrollEnd={() => {}}> + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/content/usage/react.md b/core/src/components/content/usage/react.md new file mode 100644 index 0000000000..a3c0f0d280 --- /dev/null +++ b/core/src/components/content/usage/react.md @@ -0,0 +1,16 @@ +```tsx +import React from 'react'; + +import { IonContent } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + {}} + onIonScroll={() => {}} + onIonScrollEnd={() => {}}> + +); + +export default Example; +``` diff --git a/core/src/components/datetime/readme.md b/core/src/components/datetime/readme.md index 6578ac2132..d3e36c9205 100644 --- a/core/src/components/datetime/readme.md +++ b/core/src/components/datetime/readme.md @@ -430,6 +430,134 @@ customPickerOptions.pickerOptions = customPickerButtons; ``` +### React + +```tsx +import React from 'react'; + +import { IonItem, IonLabel, IonDatetime } from '@ionic/react'; + +const customYearValues = [2020, 2016, 2008, 2004, 2000, 1996]; + +const customDayShortNames = [ + 's\u00f8n', + 'man', + 'tir', + 'ons', + 'tor', + 'fre', + 'l\u00f8r' +]; + +const Example: React.SFC<{}> = () => ( + <> + + MMMM + + + + + MM DD YY + + + + + Disabled + + + + + YYYY + console.log('Clicked Save!') + }, { + text: 'Log', + handler: () => { + console.log('Clicked Log. Do not Dismiss.'); + return false; + } + } + ] + }} + placeholder="Custom Options" displayFormat="YYYY" min="1981" max="2002"> + + + + MMMM YY + + + + + MM/DD/YYYY + + + + + MM/DD/YYYY + + + + + DDD. MMM DD, YY (custom locale) + + + + + D MMM YYYY H:mm + + + + + DDDD MMM D, YYYY + + + + + HH:mm + + + + + h:mm a + + + + + hh:mm A (15 min steps) + + + + + Leap years, summer months + + + + + Specific days/months/years + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/datetime/usage/react.md b/core/src/components/datetime/usage/react.md new file mode 100644 index 0000000000..08608bdd02 --- /dev/null +++ b/core/src/components/datetime/usage/react.md @@ -0,0 +1,124 @@ +```tsx +import React from 'react'; + +import { IonItem, IonLabel, IonDatetime } from '@ionic/react'; + +const customYearValues = [2020, 2016, 2008, 2004, 2000, 1996]; + +const customDayShortNames = [ + 's\u00f8n', + 'man', + 'tir', + 'ons', + 'tor', + 'fre', + 'l\u00f8r' +]; + +const Example: React.SFC<{}> = () => ( + <> + + MMMM + + + + + MM DD YY + + + + + Disabled + + + + + YYYY + console.log('Clicked Save!') + }, { + text: 'Log', + handler: () => { + console.log('Clicked Log. Do not Dismiss.'); + return false; + } + } + ] + }} + placeholder="Custom Options" displayFormat="YYYY" min="1981" max="2002"> + + + + MMMM YY + + + + + MM/DD/YYYY + + + + + MM/DD/YYYY + + + + + DDD. MMM DD, YY (custom locale) + + + + + D MMM YYYY H:mm + + + + + DDDD MMM D, YYYY + + + + + HH:mm + + + + + h:mm a + + + + + hh:mm A (15 min steps) + + + + + Leap years, summer months + + + + + Specific days/months/years + + + +); + +export default Example; +``` diff --git a/core/src/components/fab-button/readme.md b/core/src/components/fab-button/readme.md index 711beb2219..50b9a1793a 100644 --- a/core/src/components/fab-button/readme.md +++ b/core/src/components/fab-button/readme.md @@ -36,6 +36,39 @@ If the FAB button is not wrapped with ``, it will scroll with the conte ``` +### React + +```tsx +import React from 'react'; + +import { IonContent, IonFab, IonFabButton } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + {/*-- Fixed Floating Action Button that does not scroll with the content --*/} + + Button + + + {/*-- Default Floating Action Button that scrolls with the content.--*/} + Default + + {/*-- Mini --*/} + Mini + + {/*-- Colors --*/} + Primary + Secondary + Danger + Light + Dark + +); + +export default Example + + ## Properties diff --git a/core/src/components/fab-button/usage/react.md b/core/src/components/fab-button/usage/react.md new file mode 100644 index 0000000000..adaeae5b6a --- /dev/null +++ b/core/src/components/fab-button/usage/react.md @@ -0,0 +1,29 @@ +```tsx +import React from 'react'; + +import { IonContent, IonFab, IonFabButton } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + {/*-- Fixed Floating Action Button that does not scroll with the content --*/} + + Button + + + {/*-- Default Floating Action Button that scrolls with the content.--*/} + Default + + {/*-- Mini --*/} + Mini + + {/*-- Colors --*/} + Primary + Secondary + Danger + Light + Dark + +); + +export default Example diff --git a/core/src/components/fab-list/readme.md b/core/src/components/fab-list/readme.md index 611a0e29ad..90b78da0fe 100644 --- a/core/src/components/fab-list/readme.md +++ b/core/src/components/fab-list/readme.md @@ -27,6 +27,34 @@ The `ion-fab-list` element is a container for multiple fab buttons. This collect ``` +### React + +```tsx +import React from 'react'; + +import { IonFab, IonFabButton, IonFabList } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + Share + + + Facebook + Twitter + Youtube + + + + Vimeo + + + +); + +export default Example + + ## Properties diff --git a/core/src/components/fab-list/usage/react.md b/core/src/components/fab-list/usage/react.md new file mode 100644 index 0000000000..e8f102cd51 --- /dev/null +++ b/core/src/components/fab-list/usage/react.md @@ -0,0 +1,24 @@ +```tsx +import React from 'react'; + +import { IonFab, IonFabButton, IonFabList } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + Share + + + Facebook + Twitter + Youtube + + + + Vimeo + + + +); + +export default Example diff --git a/core/src/components/fab/readme.md b/core/src/components/fab/readme.md index ec15ada098..545b396a29 100644 --- a/core/src/components/fab/readme.md +++ b/core/src/components/fab/readme.md @@ -92,6 +92,100 @@ Fabs are container elements that contain one or more fab buttons. They should be ``` +### React + +```tsx +import React from 'react'; + +import { IonContent, IonFab, IonFabButton, IonIcon, IonFabList } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + {/*-- fab placed to the top end --*/} + + + + + + + {/*-- fab placed to the bottom end --*/} + + + + + + + {/*-- fab placed to the top start --*/} + + + + + + + {/*-- fab placed to the bottom start --*/} + + + + + + + {/*-- fab placed to the (vertical) center and start --*/} + + + + + + + {/*-- fab placed to the (vertical) center and end --*/} + + + + + + + {/*-- fab placed to the top and end and on the top edge of the content overlapping header --*/} + + + + + + + {/*-- fab placed to the bottom and start and on the bottom edge of the content overlapping footer with a list to the right --*/} + + + + + + + + + + {/*-- fab placed in the center of the content with a list on each side --*/} + + + + + + + + + + + + + + + + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/fab/usage/react.md b/core/src/components/fab/usage/react.md new file mode 100644 index 0000000000..1a5d9dfa03 --- /dev/null +++ b/core/src/components/fab/usage/react.md @@ -0,0 +1,90 @@ +```tsx +import React from 'react'; + +import { IonContent, IonFab, IonFabButton, IonIcon, IonFabList } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + {/*-- fab placed to the top end --*/} + + + + + + + {/*-- fab placed to the bottom end --*/} + + + + + + + {/*-- fab placed to the top start --*/} + + + + + + + {/*-- fab placed to the bottom start --*/} + + + + + + + {/*-- fab placed to the (vertical) center and start --*/} + + + + + + + {/*-- fab placed to the (vertical) center and end --*/} + + + + + + + {/*-- fab placed to the top and end and on the top edge of the content overlapping header --*/} + + + + + + + {/*-- fab placed to the bottom and start and on the bottom edge of the content overlapping footer with a list to the right --*/} + + + + + + + + + + {/*-- fab placed in the center of the content with a list on each side --*/} + + + + + + + + + + + + + + + + + + +); + +export default Example; +``` diff --git a/core/src/components/footer/readme.md b/core/src/components/footer/readme.md index 923affa9a5..bf00d5821e 100644 --- a/core/src/components/footer/readme.md +++ b/core/src/components/footer/readme.md @@ -21,6 +21,29 @@ Footer can be a wrapper for ion-toolbar to make sure the content area is sized c ``` +### React + +```tsx +import React from 'react'; + +import { IonContent, IonFooter, IonToolbar, IonTitle } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + + + Footer + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/footer/usage/react.md b/core/src/components/footer/usage/react.md new file mode 100644 index 0000000000..531dd19399 --- /dev/null +++ b/core/src/components/footer/usage/react.md @@ -0,0 +1,19 @@ +```tsx +import React from 'react'; + +import { IonContent, IonFooter, IonToolbar, IonTitle } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + + + Footer + + + +); + +export default Example; +``` diff --git a/core/src/components/grid/readme.md b/core/src/components/grid/readme.md index b357c351d6..7f44fad496 100644 --- a/core/src/components/grid/readme.md +++ b/core/src/components/grid/readme.md @@ -195,6 +195,197 @@ See [Grid Layout](/docs/layout/grid) for more information. ``` +### React + +```tsx +import React from 'react'; + +import { IonGrid, IonRow, IonCol } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + ion-col + + + ion-col + + + ion-col + + + ion-col + + + + + + ion-col size="6" + + + ion-col + + + ion-col + + + + + + ion-col size="3" + + + ion-col + + + ion-col size="3" + + + + + + ion-col size="3" + + + ion-col size="3" offset="3" + + + + + + ion-col + + + ion-col +
# +
+ + ion-col +
# +
# +
+ + ion-col +
# +
# +
# +
+
+ + + + ion-col start + + + ion-col center + + + ion-col end + + + ion-col +
# +
# +
+
+ + + + start ion-col + + + start ion-col + + + start ion-col end + + + ion-col +
# +
# +
+
+ + + + center ion-col + + + center ion-col + + + center ion-col + + + ion-col +
# +
# +
+
+ + + + end ion-col + + + end ion-col start + + + end ion-col + + + ion-col +
# +
# +
+
+ + + + ion-col size="12" size-sm + + + ion-col size="12" size-sm + + + ion-col size="12" size-sm + + + ion-col size="12" size-sm + + + + + + ion-col size="12" size-md + + + ion-col size="12" size-md + + + ion-col size="12" size-md + + + ion-col size="12" size-md + + + + + + ion-col size="6" size-lg offset="3" + + + ion-col size="3" size-lg + + +
+); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/grid/usage/react.md b/core/src/components/grid/usage/react.md new file mode 100644 index 0000000000..1af3519ba4 --- /dev/null +++ b/core/src/components/grid/usage/react.md @@ -0,0 +1,187 @@ +```tsx +import React from 'react'; + +import { IonGrid, IonRow, IonCol } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + ion-col + + + ion-col + + + ion-col + + + ion-col + + + + + + ion-col size="6" + + + ion-col + + + ion-col + + + + + + ion-col size="3" + + + ion-col + + + ion-col size="3" + + + + + + ion-col size="3" + + + ion-col size="3" offset="3" + + + + + + ion-col + + + ion-col +
# +
+ + ion-col +
# +
# +
+ + ion-col +
# +
# +
# +
+
+ + + + ion-col start + + + ion-col center + + + ion-col end + + + ion-col +
# +
# +
+
+ + + + start ion-col + + + start ion-col + + + start ion-col end + + + ion-col +
# +
# +
+
+ + + + center ion-col + + + center ion-col + + + center ion-col + + + ion-col +
# +
# +
+
+ + + + end ion-col + + + end ion-col start + + + end ion-col + + + ion-col +
# +
# +
+
+ + + + ion-col size="12" size-sm + + + ion-col size="12" size-sm + + + ion-col size="12" size-sm + + + ion-col size="12" size-sm + + + + + + ion-col size="12" size-md + + + ion-col size="12" size-md + + + ion-col size="12" size-md + + + ion-col size="12" size-md + + + + + + ion-col size="6" size-lg offset="3" + + + ion-col size="3" size-lg + + +
+); + +export default Example; +``` diff --git a/core/src/components/header/readme.md b/core/src/components/header/readme.md index 771ac19b87..95b4883b39 100644 --- a/core/src/components/header/readme.md +++ b/core/src/components/header/readme.md @@ -30,6 +30,35 @@ It's important to note that ion-header needs to be the one of the three root ele ``` +### React + +```tsx +import React from 'react'; + +import { IonHeader, IonContent, IonToolbar, IonButtons, IonBackButton, IonTitle } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + + {}} /> + + My Navigation Bar + + + + Subheader + + + + + +); + +export default Example + + ## Properties diff --git a/core/src/components/header/usage/react.md b/core/src/components/header/usage/react.md new file mode 100644 index 0000000000..230ff911c5 --- /dev/null +++ b/core/src/components/header/usage/react.md @@ -0,0 +1,25 @@ +```tsx +import React from 'react'; + +import { IonHeader, IonContent, IonToolbar, IonButtons, IonBackButton, IonTitle } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + + {}} /> + + My Navigation Bar + + + + Subheader + + + + + +); + +export default Example diff --git a/core/src/components/icon/usage/react.md b/core/src/components/icon/usage/react.md new file mode 100644 index 0000000000..44ca934205 --- /dev/null +++ b/core/src/components/icon/usage/react.md @@ -0,0 +1,28 @@ +```tsx +import React from 'react'; + +import { IonIcon } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- automatically uses the correct "star" icon depending on the mode --*/} + + + {/*-- explicitly set the icon for each mode --*/} + + + {/*-- always use the same icon, no matter what the mode is --*/} + + + + {/*-- use a custom svg icon --*/} + + + {/*-- set the icon size --*/} + + + +); + +export default Example; +``` diff --git a/core/src/components/img/readme.md b/core/src/components/img/readme.md index 253cd7f2f2..998cc78b3e 100644 --- a/core/src/components/img/readme.md +++ b/core/src/components/img/readme.md @@ -22,6 +22,36 @@ Img is a tag that will lazily load an image when ever the tag is in the viewport ``` +### React + +```tsx +import React from 'react'; + +import { IonList, IonItem, IonThumbnail, IonImg, IonLabel } from '@ionic/react'; + +type Item = { + src: string; + text: string +}; +const items: Item[] = []; + +const Example: React.SFC<{}> = () => ( + + + {items.map(({src, text}) => + + + + + {text}} + + )} + +); + +export default Example + + ## Properties diff --git a/core/src/components/img/usage/react.md b/core/src/components/img/usage/react.md new file mode 100644 index 0000000000..dfe0ae39dc --- /dev/null +++ b/core/src/components/img/usage/react.md @@ -0,0 +1,26 @@ +```tsx +import React from 'react'; + +import { IonList, IonItem, IonThumbnail, IonImg, IonLabel } from '@ionic/react'; + +type Item = { + src: string; + text: string +}; +const items: Item[] = []; + +const Example: React.SFC<{}> = () => ( + + + {items.map(({src, text}) => + + + + + {text}} + + )} + +); + +export default Example diff --git a/core/src/components/infinite-scroll-content/readme.md b/core/src/components/infinite-scroll-content/readme.md index 5cc32ec48f..9a4880bee3 100644 --- a/core/src/components/infinite-scroll-content/readme.md +++ b/core/src/components/infinite-scroll-content/readme.md @@ -35,6 +35,28 @@ The `ion-infinite-scroll-content` component is the default child used by the `io ``` +### React + +```tsx +import React from 'react'; + +import { IonContent, IonInfiniteScroll } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + + + +); + +export default Example + + ## Properties diff --git a/core/src/components/infinite-scroll-content/usage/react.md b/core/src/components/infinite-scroll-content/usage/react.md new file mode 100644 index 0000000000..878ac44f4d --- /dev/null +++ b/core/src/components/infinite-scroll-content/usage/react.md @@ -0,0 +1,18 @@ +```tsx +import React from 'react'; + +import { IonContent, IonInfiniteScroll } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + + + +); + +export default Example diff --git a/core/src/components/infinite-scroll/readme.md b/core/src/components/infinite-scroll/readme.md index 5afc674b76..0bcbe6498f 100644 --- a/core/src/components/infinite-scroll/readme.md +++ b/core/src/components/infinite-scroll/readme.md @@ -111,6 +111,69 @@ function toggleInfiniteScroll() { ``` +### React + +```tsx +import React from 'react'; + +import { IonAvatar } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + Toggle Infinite Scroll + + + + + + + + + + + + + import { Component, ViewChild } from '@angular/core'; + import { IonInfiniteScroll } from '@ionic/angular'; + + @Component({ + selector: 'infinite-scroll-example', + templateUrl: 'infinite-scroll-example.html', + styleUrls: ['./infinite-scroll-example.css'] + }) + export class InfiniteScrollExample { + @ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll; + + constructor() {} + + loadData(event) { + setTimeout(() => { + console.log('Done'); + event.target.complete(); + + // App logic to determine if all data is loaded + // and disable the infinite scroll + if (data.length == 1000) { + event.target.disabled = true; + } + }, 500); + } + + toggleInfiniteScroll() { + this.infiniteScroll.disabled = !this.infiniteScroll.disabled; + } + } + + +); + +export default Example + + ## Properties diff --git a/core/src/components/infinite-scroll/usage/react.md b/core/src/components/infinite-scroll/usage/react.md new file mode 100644 index 0000000000..d81ab0c062 --- /dev/null +++ b/core/src/components/infinite-scroll/usage/react.md @@ -0,0 +1,59 @@ +```tsx +import React from 'react'; + +import { IonAvatar } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + Toggle Infinite Scroll + + + + + + + + + + + + + import { Component, ViewChild } from '@angular/core'; + import { IonInfiniteScroll } from '@ionic/angular'; + + @Component({ + selector: 'infinite-scroll-example', + templateUrl: 'infinite-scroll-example.html', + styleUrls: ['./infinite-scroll-example.css'] + }) + export class InfiniteScrollExample { + @ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll; + + constructor() {} + + loadData(event) { + setTimeout(() => { + console.log('Done'); + event.target.complete(); + + // App logic to determine if all data is loaded + // and disable the infinite scroll + if (data.length == 1000) { + event.target.disabled = true; + } + }, 500); + } + + toggleInfiniteScroll() { + this.infiniteScroll.disabled = !this.infiniteScroll.disabled; + } + } + + +); + +export default Example diff --git a/core/src/components/input/readme.md b/core/src/components/input/readme.md index d5f4369adb..4b11d1d5ab 100644 --- a/core/src/components/input/readme.md +++ b/core/src/components/input/readme.md @@ -104,6 +104,62 @@ It is meant for text `type` inputs only, such as `"text"`, `"password"`, `"email ``` +### React + +```tsx +import React from 'react'; + +import { IonInput, IonItem, IonLabel } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Input --*/} + + + {/*-- Input with value --*/} + + + {/*-- Input with placeholder --*/} + + + {/*-- Input with clear button when there is a value --*/} + + + {/*-- Number type input --*/} + + + {/*-- Disabled input --*/} + + + {/*-- Readonly input --*/} + + + {/*-- Inputs with labels --*/} + + Default Label + + + + + Floating Label + + + + + Fixed Label + + + + + Stacked Label + + + +); + +export default Example + + ## Properties diff --git a/core/src/components/input/usage/react.md b/core/src/components/input/usage/react.md new file mode 100644 index 0000000000..100964ef74 --- /dev/null +++ b/core/src/components/input/usage/react.md @@ -0,0 +1,52 @@ +```tsx +import React from 'react'; + +import { IonInput, IonItem, IonLabel } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Input --*/} + + + {/*-- Input with value --*/} + + + {/*-- Input with placeholder --*/} + + + {/*-- Input with clear button when there is a value --*/} + + + {/*-- Number type input --*/} + + + {/*-- Disabled input --*/} + + + {/*-- Readonly input --*/} + + + {/*-- Inputs with labels --*/} + + Default Label + + + + + Floating Label + + + + + Fixed Label + + + + + Stacked Label + + + +); + +export default Example diff --git a/core/src/components/item-divider/readme.md b/core/src/components/item-divider/readme.md index 43863db7fe..e74ac227a0 100644 --- a/core/src/components/item-divider/readme.md +++ b/core/src/components/item-divider/readme.md @@ -51,6 +51,59 @@ Item Dividers are block elements that can be used to separate items in a list. T ``` +### React + +```tsx +import React from 'react'; + +import { IonItemDivider, IonLabel, IonList, IonItem } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + Basic Item Divider + + + + + + Secondary Item Divider + + + + {/*-- Item Dividers in a List --*/} + + + + Section A + + + + A1 + A2 + A3 + A4 + A5 + + + + Section B + + + + B1 + B2 + B3 + B4 + B5 + + +); + +export default Example + + ## Properties diff --git a/core/src/components/item-divider/usage/react.md b/core/src/components/item-divider/usage/react.md new file mode 100644 index 0000000000..9d7f5c35d8 --- /dev/null +++ b/core/src/components/item-divider/usage/react.md @@ -0,0 +1,49 @@ +```tsx +import React from 'react'; + +import { IonItemDivider, IonLabel, IonList, IonItem } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + Basic Item Divider + + + + + + Secondary Item Divider + + + + {/*-- Item Dividers in a List --*/} + + + + Section A + + + + A1 + A2 + A3 + A4 + A5 + + + + Section B + + + + B1 + B2 + B3 + B4 + B5 + + +); + +export default Example diff --git a/core/src/components/item-group/readme.md b/core/src/components/item-group/readme.md index 5c4eb3d67c..69c10c5e59 100644 --- a/core/src/components/item-group/readme.md +++ b/core/src/components/item-group/readme.md @@ -117,6 +117,123 @@ Item groups are containers that organize similar items together. They can contai ``` +### React + +```tsx +import React from 'react'; + +import { IonItemGroup, IonItemDivider, IonLabel, IonItem, IonItemSliding, IonItemOptions, IonItemOption } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + A + + + + Angola + + + Argentina + + + Armenia + + + + + + B + + + + Bangladesh + + + Belarus + + + Belgium + + + + + {/*-- They can also be used to group sliding items --*/} + + + + Fruits + + + + + + +

Grapes

+
+
+ + + Favorite + + +
+ + + + +

Apples

+
+
+ + + Favorite + + +
+
+ + + + + Vegetables + + + + + + +

Carrots

+
+
+ + + Favorite + + +
+ + + + +

Celery

+
+
+ + + Favorite + + +
+
+ +); + +export default Example; +``` + + ---------------------------------------------- diff --git a/core/src/components/item-group/usage/react.md b/core/src/components/item-group/usage/react.md new file mode 100644 index 0000000000..584e59bb35 --- /dev/null +++ b/core/src/components/item-group/usage/react.md @@ -0,0 +1,113 @@ +```tsx +import React from 'react'; + +import { IonItemGroup, IonItemDivider, IonLabel, IonItem, IonItemSliding, IonItemOptions, IonItemOption } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + A + + + + Angola + + + Argentina + + + Armenia + + + + + + B + + + + Bangladesh + + + Belarus + + + Belgium + + + + + {/*-- They can also be used to group sliding items --*/} + + + + Fruits + + + + + + +

Grapes

+
+
+ + + Favorite + + +
+ + + + +

Apples

+
+
+ + + Favorite + + +
+
+ + + + + Vegetables + + + + + + +

Carrots

+
+
+ + + Favorite + + +
+ + + + +

Celery

+
+
+ + + Favorite + + +
+
+ +); + +export default Example; +``` diff --git a/core/src/components/item-sliding/readme.md b/core/src/components/item-sliding/readme.md index c92cce8d7a..169aeeafea 100644 --- a/core/src/components/item-sliding/readme.md +++ b/core/src/components/item-sliding/readme.md @@ -73,6 +73,37 @@ Options can be expanded to take up the full width of the item if you swipe past ``` +### React + +```tsx +import React from 'react'; + +import { IonList, IonItemSliding, IonItem, IonLabel, IonItemOptions, IonItemOption } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + Item + + + {}}>Favorite + {}}>Share + + + + {}}>Unread + + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/item-sliding/usage/react.md b/core/src/components/item-sliding/usage/react.md new file mode 100644 index 0000000000..fdaab9a922 --- /dev/null +++ b/core/src/components/item-sliding/usage/react.md @@ -0,0 +1,27 @@ +```tsx +import React from 'react'; + +import { IonList, IonItemSliding, IonItem, IonLabel, IonItemOptions, IonItemOption } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + Item + + + {}}>Favorite + {}}>Share + + + + {}}>Unread + + + + +); + +export default Example; +``` diff --git a/core/src/components/item/readme.md b/core/src/components/item/readme.md index 99133f29c7..7c1ee81588 100644 --- a/core/src/components/item/readme.md +++ b/core/src/components/item/readme.md @@ -704,6 +704,320 @@ Item Inputs ``` +### React + +```tsx +import React from 'react'; + +import { IonItem, IonLabel, IonList, IonText, IonAvatar, IonThumbnail, IonButton, IonIcon, IonSelect, IonSelectOption, IonDatetime, IonToggle, IonInput, IonCheckbox, IonRange } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Item --*/} + + + Item + + + + {/*-- Item as a Button --*/} + {}}> + + Button Item + + + + {/*-- Item as an Anchor --*/} + + + Anchor Item + + + + + + Secondary Color Item + + + + {/*-- Detail Arrows --*/} + + + + Standard Item with Detail Arrow + + + + {}} detail> + + Button Item with Detail Arrow + + + + + + Anchor Item with no Detail Arrow + + + + + + + + Item + + + + + + No Lines Item + + + + + + Multiline text that should wrap when it is too long + to fit on one line in the item. + + + + + + +

H3 Primary Title

+
+

Paragraph line 1

+ +

Paragraph line 2 secondary

+
+
+
+ + + + Item with Full Lines + + + +
+ + + {/*-- Item Inset Lines --*/} + + Item Lines Inset + + + {/*-- Item Full Lines --*/} + + Item Lines Full + + + {/*-- Item None Lines --*/} + + Item Lines None + + + {/*-- List Full Lines --*/} + + + Full Lines Item 1 + + + + Full Lines Item 2 + + + + {/*-- List Inset Lines --*/} + + + Inset Lines Item 1 + + + + Inset Lines Item 2 + + + + {/*-- List No Lines --*/} + + + No lines Item 1 + + + + No lines Item 2 + + + + No lines Item 3 + + + + + + {}}> + + + + + Avatar Start, Button Item + + + + + + Thumbnail End, Anchor Item + + + + + + + + + + + +

H2 Title Text

+

Button on right

+
+ View +
+ + {}}> + + + + +

H3 Title Text

+

Icon on right

+
+ +
+ + + Buttons in Items + + + + + Start + + Button Start/End + + End + + + + + + Start Icon + + + Buttons with Icons + + + End Icon + + + + + + + + Icon only Buttons + + + + + + + + + Icon End + + + + + + + Large Icon End + + + + + + + Small Icon End + + + + + + + + Icon Start + + + + + + Two Icons End + + + + + + + Datetime + + + + + Select + + No Game Console + NES + Nintendo64 + PlayStation + Sega Genesis + Sega Saturn + SNES + + + + + Toggle + + + + + Floating Input + + + + + Input (placeholder) + + + + + Checkbox + + + + + Range + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/item/usage/react.md b/core/src/components/item/usage/react.md new file mode 100644 index 0000000000..5eec59d598 --- /dev/null +++ b/core/src/components/item/usage/react.md @@ -0,0 +1,310 @@ +```tsx +import React from 'react'; + +import { IonItem, IonLabel, IonList, IonText, IonAvatar, IonThumbnail, IonButton, IonIcon, IonSelect, IonSelectOption, IonDatetime, IonToggle, IonInput, IonCheckbox, IonRange } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Item --*/} + + + Item + + + + {/*-- Item as a Button --*/} + {}}> + + Button Item + + + + {/*-- Item as an Anchor --*/} + + + Anchor Item + + + + + + Secondary Color Item + + + + {/*-- Detail Arrows --*/} + + + + Standard Item with Detail Arrow + + + + {}} detail> + + Button Item with Detail Arrow + + + + + + Anchor Item with no Detail Arrow + + + + + + + + Item + + + + + + No Lines Item + + + + + + Multiline text that should wrap when it is too long + to fit on one line in the item. + + + + + + +

H3 Primary Title

+
+

Paragraph line 1

+ +

Paragraph line 2 secondary

+
+
+
+ + + + Item with Full Lines + + + +
+ + + {/*-- Item Inset Lines --*/} + + Item Lines Inset + + + {/*-- Item Full Lines --*/} + + Item Lines Full + + + {/*-- Item None Lines --*/} + + Item Lines None + + + {/*-- List Full Lines --*/} + + + Full Lines Item 1 + + + + Full Lines Item 2 + + + + {/*-- List Inset Lines --*/} + + + Inset Lines Item 1 + + + + Inset Lines Item 2 + + + + {/*-- List No Lines --*/} + + + No lines Item 1 + + + + No lines Item 2 + + + + No lines Item 3 + + + + + + {}}> + + + + + Avatar Start, Button Item + + + + + + Thumbnail End, Anchor Item + + + + + + + + + + + +

H2 Title Text

+

Button on right

+
+ View +
+ + {}}> + + + + +

H3 Title Text

+

Icon on right

+
+ +
+ + + Buttons in Items + + + + + Start + + Button Start/End + + End + + + + + + Start Icon + + + Buttons with Icons + + + End Icon + + + + + + + + Icon only Buttons + + + + + + + + + Icon End + + + + + + + Large Icon End + + + + + + + Small Icon End + + + + + + + + Icon Start + + + + + + Two Icons End + + + + + + + Datetime + + + + + Select + + No Game Console + NES + Nintendo64 + PlayStation + Sega Genesis + Sega Saturn + SNES + + + + + Toggle + + + + + Floating Input + + + + + Input (placeholder) + + + + + Checkbox + + + + + Range + + + +); + +export default Example; +``` diff --git a/core/src/components/label/readme.md b/core/src/components/label/readme.md index d79479df4c..e4e5ac746b 100644 --- a/core/src/components/label/readme.md +++ b/core/src/components/label/readme.md @@ -66,6 +66,74 @@ Label is a wrapper element that can be used in combination with `ion-item`, `ion ``` +### React + +```tsx +import React from 'react'; + +import { IonLabel, IonItem, IonInput, IonToggle, IonCheckbox } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Label --*/} + Label + + {/*-- Label Colors --*/} + Primary Label + Secondary Label + Danger Label + Light Label + Dark Label + + {/*-- Item Labels --*/} + + Default Item + + + + + Multi-line text that should wrap when it is too long + to fit on one line in the item. + + + + {/*-- Input Labels --*/} + + Default Input + + + + + Fixed + + + + + Floating + + + + + Stacked + + + + + Toggle + + + + + + Checkbox + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/label/usage/react.md b/core/src/components/label/usage/react.md new file mode 100644 index 0000000000..ec8a48fea5 --- /dev/null +++ b/core/src/components/label/usage/react.md @@ -0,0 +1,64 @@ +```tsx +import React from 'react'; + +import { IonLabel, IonItem, IonInput, IonToggle, IonCheckbox } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Label --*/} + Label + + {/*-- Label Colors --*/} + Primary Label + Secondary Label + Danger Label + Light Label + Dark Label + + {/*-- Item Labels --*/} + + Default Item + + + + + Multi-line text that should wrap when it is too long + to fit on one line in the item. + + + + {/*-- Input Labels --*/} + + Default Input + + + + + Fixed + + + + + Floating + + + + + Stacked + + + + + Toggle + + + + + + Checkbox + + +); + +export default Example; +``` diff --git a/core/src/components/list/readme.md b/core/src/components/list/readme.md index 4613c50e61..3981793f26 100644 --- a/core/src/components/list/readme.md +++ b/core/src/components/list/readme.md @@ -141,6 +141,81 @@ Lists support several interactions including swiping items to reveal options, dr ``` +### React + +```tsx +import React from 'react'; + +import { IonList, IonItem, IonLabel, IonInput, IonToggle, IonRadio, IonCheckbox, IonItemSliding, IonItemOption, IonItemOptions } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- List of Text Items --*/} + + + Pokémon Yellow + + + Mega Man X + + + The Legend of Zelda + + + Pac-Man + + + Super Mario World + + + + {/*-- List of Input Items --*/} + + + Input + + + + Toggle + + + + Radio + + + + Checkbox + + + + + {/*-- List of Sliding Items --*/} + + + + Item + + + {}}>Unread + + + + + + Item + + + {}}>Unread + + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/list/usage/react.md b/core/src/components/list/usage/react.md new file mode 100644 index 0000000000..4c5f7427b2 --- /dev/null +++ b/core/src/components/list/usage/react.md @@ -0,0 +1,71 @@ +```tsx +import React from 'react'; + +import { IonList, IonItem, IonLabel, IonInput, IonToggle, IonRadio, IonCheckbox, IonItemSliding, IonItemOption, IonItemOptions } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- List of Text Items --*/} + + + Pokémon Yellow + + + Mega Man X + + + The Legend of Zelda + + + Pac-Man + + + Super Mario World + + + + {/*-- List of Input Items --*/} + + + Input + + + + Toggle + + + + Radio + + + + Checkbox + + + + + {/*-- List of Sliding Items --*/} + + + + Item + + + {}}>Unread + + + + + + Item + + + {}}>Unread + + + + +); + +export default Example; +``` diff --git a/core/src/components/loading/readme.md b/core/src/components/loading/readme.md index 713d9f4c3c..8bfa8acc90 100644 --- a/core/src/components/loading/readme.md +++ b/core/src/components/loading/readme.md @@ -93,6 +93,55 @@ async function presentLoadingWithOptions() { ``` +### React + +```tsx +import React, { Component } from 'react' +import { IonLoading } from '@ionic/react'; + +type Props = {} +type State = { + showLoading1: boolean + showLoading2: boolean +} + +export class LoadingExample extends Component { + + constructor(props: Props) { + super(props); + this.state = { + showLoading1: false + showLoading2: false + }; + } + + render() { + return ( + this.setState(() => ({ showLoading1: false }))} + message={'Hellooo'} + duration={200} + > + + + this.setState(() => ({ showLoading2: false }))} + spinner={null} + duration={5000} + message='Please wait...'} + translucent={true} + cssClass='custom-class custom-loading' + > + + ); + } +} + +``` + + ## Properties diff --git a/core/src/components/loading/usage/react.md b/core/src/components/loading/usage/react.md new file mode 100644 index 0000000000..5497631c52 --- /dev/null +++ b/core/src/components/loading/usage/react.md @@ -0,0 +1,45 @@ +```tsx +import React, { Component } from 'react' +import { IonLoading } from '@ionic/react'; + +type Props = {} +type State = { + showLoading1: boolean + showLoading2: boolean +} + +export class LoadingExample extends Component { + + constructor(props: Props) { + super(props); + this.state = { + showLoading1: false + showLoading2: false + }; + } + + render() { + return ( + this.setState(() => ({ showLoading1: false }))} + message={'Hellooo'} + duration={200} + > + + + this.setState(() => ({ showLoading2: false }))} + spinner={null} + duration={5000} + message='Please wait...'} + translucent={true} + cssClass='custom-class custom-loading' + > + + ); + } +} + +``` diff --git a/core/src/components/menu/readme.md b/core/src/components/menu/readme.md index bd1f35a5ad..be054cfe13 100644 --- a/core/src/components/menu/readme.md +++ b/core/src/components/menu/readme.md @@ -203,6 +203,73 @@ function openCustom() { ``` +### React + +```tsx +import React from 'react'; + +import { IonMenu, IonHeader, IonToolbar, IonTitle, IonContent, IonList, IonItem, IonRouterOutlet } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + + Start Menu + + + + + Menu Item + Menu Item + Menu Item + Menu Item + Menu Item + + + + + + + + Custom Menu + + + + + Menu Item + Menu Item + Menu Item + Menu Item + Menu Item + + + + + + + + End Menu + + + + + Menu Item + Menu Item + Menu Item + Menu Item + Menu Item + + + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/menu/usage/react.md b/core/src/components/menu/usage/react.md new file mode 100644 index 0000000000..3d3a93a599 --- /dev/null +++ b/core/src/components/menu/usage/react.md @@ -0,0 +1,63 @@ +```tsx +import React from 'react'; + +import { IonMenu, IonHeader, IonToolbar, IonTitle, IonContent, IonList, IonItem, IonRouterOutlet } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + + Start Menu + + + + + Menu Item + Menu Item + Menu Item + Menu Item + Menu Item + + + + + + + + Custom Menu + + + + + Menu Item + Menu Item + Menu Item + Menu Item + Menu Item + + + + + + + + End Menu + + + + + Menu Item + Menu Item + Menu Item + Menu Item + Menu Item + + + + + +); + +export default Example; +``` diff --git a/core/src/components/modal/readme.md b/core/src/components/modal/readme.md index 9830a856c9..35766d528b 100644 --- a/core/src/components/modal/readme.md +++ b/core/src/components/modal/readme.md @@ -140,6 +140,44 @@ async function presentModal() { ``` +### React + +```tsx +import React, { Component } from 'react' +import { IonModal } from '@ionic/react'; + +type Props = {} +type State = { + showModal: boolean +} + +export class ModalExample extends Component { + + constructor(props: Props) { + super(props); + this.state = { + showModal: false + }; + } + + render() { + return ( + this.setState(() => ({ showModal: false }))} + > +

This is modal content

+ this.setState(() => ({ showModal: false }))}> + Close Modal + +
+ ); + } +} + +``` + + ## Properties diff --git a/core/src/components/modal/usage/react.md b/core/src/components/modal/usage/react.md new file mode 100644 index 0000000000..bca49bf5bc --- /dev/null +++ b/core/src/components/modal/usage/react.md @@ -0,0 +1,34 @@ +```tsx +import React, { Component } from 'react' +import { IonModal } from '@ionic/react'; + +type Props = {} +type State = { + showModal: boolean +} + +export class ModalExample extends Component { + + constructor(props: Props) { + super(props); + this.state = { + showModal: false + }; + } + + render() { + return ( + this.setState(() => ({ showModal: false }))} + > +

This is modal content

+ this.setState(() => ({ showModal: false }))}> + Close Modal + +
+ ); + } +} + +``` diff --git a/core/src/components/note/readme.md b/core/src/components/note/readme.md index 82fda1ee2d..111ee5f920 100644 --- a/core/src/components/note/readme.md +++ b/core/src/components/note/readme.md @@ -36,6 +36,43 @@ Notes are text elements generally used as subtitles that provide more informatio ``` +### React + +```tsx +import React from 'react'; + +import { IonNote, IonList, IonItem, IonLabel } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Note --*/} + Default Note + + {/*-- Note Colors --*/} + Primary Note + Secondary Note + Danger Note + Light Note + Dark Note + + {/*-- Notes in a List --*/} + + + Note (End) + On + + + + Off + Note (Start) + + + +); + +export default Example + + ## Properties diff --git a/core/src/components/note/usage/react.md b/core/src/components/note/usage/react.md new file mode 100644 index 0000000000..4868c08fae --- /dev/null +++ b/core/src/components/note/usage/react.md @@ -0,0 +1,33 @@ +```tsx +import React from 'react'; + +import { IonNote, IonList, IonItem, IonLabel } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Note --*/} + Default Note + + {/*-- Note Colors --*/} + Primary Note + Secondary Note + Danger Note + Light Note + Dark Note + + {/*-- Notes in a List --*/} + + + Note (End) + On + + + + Off + Note (Start) + + + +); + +export default Example diff --git a/core/src/components/popover/readme.md b/core/src/components/popover/readme.md index 48c5c9e57c..13cecb1fcb 100644 --- a/core/src/components/popover/readme.md +++ b/core/src/components/popover/readme.md @@ -60,6 +60,41 @@ async function presentPopover(ev) { ``` +### React + +```tsx +import React, { Component } from 'react' +import { IonPopover } from '@ionic/react'; + +type Props = {} +type State = { + showPopover: boolean +} + +export class PopoverExample extends Component { + + constructor(props: Props) { + super(props); + this.state = { + showPopover: false + }; + } + + render() { + return ( + this.setState(() => ({ showPopover: false }))} + > +

This is popover content

+
+ ); + } +} + +``` + + ## Properties diff --git a/core/src/components/popover/usage/react.md b/core/src/components/popover/usage/react.md new file mode 100644 index 0000000000..f8bcdf692e --- /dev/null +++ b/core/src/components/popover/usage/react.md @@ -0,0 +1,31 @@ +```tsx +import React, { Component } from 'react' +import { IonPopover } from '@ionic/react'; + +type Props = {} +type State = { + showPopover: boolean +} + +export class PopoverExample extends Component { + + constructor(props: Props) { + super(props); + this.state = { + showPopover: false + }; + } + + render() { + return ( + this.setState(() => ({ showPopover: false }))} + > +

This is popover content

+
+ ); + } +} + +``` diff --git a/core/src/components/progress-bar/readme.md b/core/src/components/progress-bar/readme.md index 9368069339..42d53c9e5f 100644 --- a/core/src/components/progress-bar/readme.md +++ b/core/src/components/progress-bar/readme.md @@ -41,6 +41,36 @@ If you add `reversed="true"`, you receive a query which is used to indicate pre- ``` +### React + +```tsx +import React from 'react'; + +import { IonProgressBar } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Progressbar --*/} + + + {/*-- Default Progressbar with 50 percent --*/} + + + {/*-- Colorize Progressbar --*/} + + + + {/*-- Other types --*/} + + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/progress-bar/usage/react.md b/core/src/components/progress-bar/usage/react.md new file mode 100644 index 0000000000..8ddac409c2 --- /dev/null +++ b/core/src/components/progress-bar/usage/react.md @@ -0,0 +1,26 @@ +```tsx +import React from 'react'; + +import { IonProgressBar } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Progressbar --*/} + + + {/*-- Default Progressbar with 50 percent --*/} + + + {/*-- Colorize Progressbar --*/} + + + + {/*-- Other types --*/} + + + + +); + +export default Example; +``` diff --git a/core/src/components/radio-group/readme.md b/core/src/components/radio-group/readme.md index 506bdde20f..00f14185ba 100644 --- a/core/src/components/radio-group/readme.md +++ b/core/src/components/radio-group/readme.md @@ -51,6 +51,52 @@ radio button within the same group. ``` +### React + +```tsx +import React from 'react'; + +import { IonList, IonRadioGroup, IonListHeader, IonLabel, IonRadio, IonItem } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + Auto Manufacturers + + + + Cord + + + + + Duesenberg + + + + + Hudson + + + + + Packard + + + + + Studebaker + + + + +); + +export default Example + + ## Properties diff --git a/core/src/components/radio-group/usage/react.md b/core/src/components/radio-group/usage/react.md new file mode 100644 index 0000000000..79f4ba2de1 --- /dev/null +++ b/core/src/components/radio-group/usage/react.md @@ -0,0 +1,42 @@ +```tsx +import React from 'react'; + +import { IonList, IonRadioGroup, IonListHeader, IonLabel, IonRadio, IonItem } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + Auto Manufacturers + + + + Cord + + + + + Duesenberg + + + + + Hudson + + + + + Packard + + + + + Studebaker + + + + +); + +export default Example diff --git a/core/src/components/radio/readme.md b/core/src/components/radio/readme.md index a3ff4b87c9..d751718c6a 100644 --- a/core/src/components/radio/readme.md +++ b/core/src/components/radio/readme.md @@ -40,6 +40,42 @@ An `ion-radio-group` can be used to group a set of radios. When radios are insid ``` +### React + +```tsx +import React from 'react'; + +import { IonList, IonRadioGroup, IonListHeader, IonLabel, IonItem, IonRadio } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + Name + + + + Biff + + + + + Griff + + + + + Buford + + + + +); + +export default Example + + ## Properties diff --git a/core/src/components/radio/usage/react.md b/core/src/components/radio/usage/react.md new file mode 100644 index 0000000000..6b4a692d37 --- /dev/null +++ b/core/src/components/radio/usage/react.md @@ -0,0 +1,32 @@ +```tsx +import React from 'react'; + +import { IonList, IonRadioGroup, IonListHeader, IonLabel, IonItem, IonRadio } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + Name + + + + Biff + + + + + Griff + + + + + Buford + + + + +); + +export default Example diff --git a/core/src/components/range/readme.md b/core/src/components/range/readme.md index ca9655cb49..90a9a428d3 100644 --- a/core/src/components/range/readme.md +++ b/core/src/components/range/readme.md @@ -83,6 +83,48 @@ left or right of the range. ``` +### React + +```tsx +import React from 'react'; + +import { IonList, IonItem, IonRange, IonLabel, IonIcon } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + + + + + -200 + 200 + + + + + + + + + + + + + + + + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/range/usage/react.md b/core/src/components/range/usage/react.md new file mode 100644 index 0000000000..c9580037f4 --- /dev/null +++ b/core/src/components/range/usage/react.md @@ -0,0 +1,38 @@ +```tsx +import React from 'react'; + +import { IonList, IonItem, IonRange, IonLabel, IonIcon } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + + + + + -200 + 200 + + + + + + + + + + + + + + + + + + +); + +export default Example; +``` diff --git a/core/src/components/refresher/readme.md b/core/src/components/refresher/readme.md index 722d64903a..954ee8a17b 100644 --- a/core/src/components/refresher/readme.md +++ b/core/src/components/refresher/readme.md @@ -85,6 +85,52 @@ export class RefresherExample { ``` +### React + +```tsx +import React from 'react'; + +import { IonContent, IonRefresher, IonRefresherContent } from '@ionic/react'; + +function doRefresh(event: CustomEvent) { + console.log('Begin async operation'); + + setTimeout(() => { + console.log('Async operation has ended'); + event.target.complete(); + }, 2000); +} + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Refresher --*/} + + + + + + + {/*-- Custom Refresher Content --*/} + + + + + + + + + } + + +); + +export default Example + + ## Properties diff --git a/core/src/components/refresher/usage/react.md b/core/src/components/refresher/usage/react.md new file mode 100644 index 0000000000..e8bd3308b7 --- /dev/null +++ b/core/src/components/refresher/usage/react.md @@ -0,0 +1,42 @@ +```tsx +import React from 'react'; + +import { IonContent, IonRefresher, IonRefresherContent } from '@ionic/react'; + +function doRefresh(event: CustomEvent) { + console.log('Begin async operation'); + + setTimeout(() => { + console.log('Async operation has ended'); + event.target.complete(); + }, 2000); +} + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Refresher --*/} + + + + + + + {/*-- Custom Refresher Content --*/} + + + + + + + + + } + + +); + +export default Example diff --git a/core/src/components/reorder-group/readme.md b/core/src/components/reorder-group/readme.md index d6e683e973..4ed45fd7ef 100644 --- a/core/src/components/reorder-group/readme.md +++ b/core/src/components/reorder-group/readme.md @@ -164,6 +164,67 @@ reorderGroup.addEventListener('ionItemReorder', ({detail}) => { ``` +### React + +```tsx +import React from 'react'; + +import { IonContent, IonList, IonItem, IonLabel, IonReorder, IonReorderGroup, IonIcon } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + + + + Item 1 + + + + + + + Item 2 (default ion-reorder slot="start") + + + + + + + Item 3 (custom ion-reorder) + + + + + + + + + Item 4 (custom ion-reorder slot="start") + + + + + + + + + + Item 5 (the whole item can be dragged) + + + + + + + +); + +export default Example + + ## Properties diff --git a/core/src/components/reorder-group/usage/react.md b/core/src/components/reorder-group/usage/react.md new file mode 100644 index 0000000000..4dbe998621 --- /dev/null +++ b/core/src/components/reorder-group/usage/react.md @@ -0,0 +1,57 @@ +```tsx +import React from 'react'; + +import { IonContent, IonList, IonItem, IonLabel, IonReorder, IonReorderGroup, IonIcon } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + + + + Item 1 + + + + + + + Item 2 (default ion-reorder slot="start") + + + + + + + Item 3 (custom ion-reorder) + + + + + + + + + Item 4 (custom ion-reorder slot="start") + + + + + + + + + + Item 5 (the whole item can be dragged) + + + + + + + +); + +export default Example diff --git a/core/src/components/searchbar/readme.md b/core/src/components/searchbar/readme.md index 1e20614de4..769a421113 100644 --- a/core/src/components/searchbar/readme.md +++ b/core/src/components/searchbar/readme.md @@ -79,6 +79,50 @@ A Searchbar should be used instead of an input to search lists. A clear button i ``` +### React + +```tsx +import React from 'react'; + +import { IonSearchbar, IonToolbar } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Searchbar --*/} + + + {/*-- Searchbar with danger color --*/} + + + {/*-- Searchbar with value --*/} + + + {/*-- Searchbar with telephone type --*/} + + + {/*-- Searchbar with a cancel button and custom cancel button text --*/} + + + {/*-- Searchbar with a custom debounce --*/} + + + {/*-- Animated Searchbar --*/} + + + {/*-- Searchbar with a placeholder --*/} + + + {/*-- Searchbar in a Toolbar --*/} + + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/searchbar/usage/react.md b/core/src/components/searchbar/usage/react.md new file mode 100644 index 0000000000..6101b9034b --- /dev/null +++ b/core/src/components/searchbar/usage/react.md @@ -0,0 +1,40 @@ +```tsx +import React from 'react'; + +import { IonSearchbar, IonToolbar } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Searchbar --*/} + + + {/*-- Searchbar with danger color --*/} + + + {/*-- Searchbar with value --*/} + + + {/*-- Searchbar with telephone type --*/} + + + {/*-- Searchbar with a cancel button and custom cancel button text --*/} + + + {/*-- Searchbar with a custom debounce --*/} + + + {/*-- Animated Searchbar --*/} + + + {/*-- Searchbar with a placeholder --*/} + + + {/*-- Searchbar in a Toolbar --*/} + + + + +); + +export default Example; +``` diff --git a/core/src/components/segment-button/readme.md b/core/src/components/segment-button/readme.md index f3055aeb1f..5d0b951794 100644 --- a/core/src/components/segment-button/readme.md +++ b/core/src/components/segment-button/readme.md @@ -315,6 +315,157 @@ for (let i = 0; i < segmentButtons.length; i++) { ``` +### React + +```tsx +import React from 'react'; + +import { IonSegment, IonSegmentButton, IonLabel, IonIcon } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Segment buttons with text and click listeners --*/} + + console.log('Friends segment selected')}> + Friends + + console.log('Enemies segment selected')}> + Enemies + + + + {/*-- Segment buttons with the first checked and the last disabled --*/} + + + Paid + + + Free + + + Top + + + + {/*-- Segment buttons with values and icons --*/} + + + + + + + + + + {/*-- Segment with a value that checks the last button --*/} + + + Bookmarks + + + Reading List + + + Shared Links + + + + {/*-- Label only --*/} + + + Item One + + + Item Two + + + Item Three + + + + {/*-- Icon only --*/} + + + + + + + + + + + + + {/*-- Icon top --*/} + + + Item One + + + + Item Two + + + + Item Three + + + + + {/*-- Icon bottom --*/} + + + + Item One + + + + Item Two + + + + Item Three + + + + {/*-- Icon start --*/} + + + Item One + + + + Item Two + + + + Item Three + + + + + {/*-- Icon end --*/} + + + + Item One + + + + Item Two + + + + Item Three + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/segment-button/usage/react.md b/core/src/components/segment-button/usage/react.md new file mode 100644 index 0000000000..be55e938ca --- /dev/null +++ b/core/src/components/segment-button/usage/react.md @@ -0,0 +1,147 @@ +```tsx +import React from 'react'; + +import { IonSegment, IonSegmentButton, IonLabel, IonIcon } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Segment buttons with text and click listeners --*/} + + console.log('Friends segment selected')}> + Friends + + console.log('Enemies segment selected')}> + Enemies + + + + {/*-- Segment buttons with the first checked and the last disabled --*/} + + + Paid + + + Free + + + Top + + + + {/*-- Segment buttons with values and icons --*/} + + + + + + + + + + {/*-- Segment with a value that checks the last button --*/} + + + Bookmarks + + + Reading List + + + Shared Links + + + + {/*-- Label only --*/} + + + Item One + + + Item Two + + + Item Three + + + + {/*-- Icon only --*/} + + + + + + + + + + + + + {/*-- Icon top --*/} + + + Item One + + + + Item Two + + + + Item Three + + + + + {/*-- Icon bottom --*/} + + + + Item One + + + + Item Two + + + + Item Three + + + + {/*-- Icon start --*/} + + + Item One + + + + Item Two + + + + Item Three + + + + + {/*-- Icon end --*/} + + + + Item One + + + + Item Two + + + + Item Three + + + +); + +export default Example; +``` diff --git a/core/src/components/segment/readme.md b/core/src/components/segment/readme.md index d5f535b0a6..4e60c2982d 100644 --- a/core/src/components/segment/readme.md +++ b/core/src/components/segment/readme.md @@ -225,6 +225,111 @@ for (let i = 0; i < segments.length; i++) { ``` +### React + +```tsx +import React from 'react'; + +import { IonSegment, IonSegmentButton, IonLabel, IonIcon, IonToolbar } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Segment --*/} + console.log('Segment selected', e.detail.value)}> + + Friends + + + Enemies + + + + {/*-- Disabled Segment --*/} + console.log('Segment selected', e.detail.value)} disabled> + + Sunny + + + Rainy + + + + {/*-- Segment with anchors --*/} + console.log('Segment selected', e.detail.value)}> + + Dogs + + + Cats + + + + {/*-- Scrollable Segment --*/} + + + + + + + + + + + + + + + + + + + + + + + + + {/*-- Segment with secondary color --*/} + console.log('Segment selected', e.detail.value)} color="secondary"> + + Standard + + + Hybrid + + + Satellite + + + + {/*-- Segment in a toolbar --*/} + + console.log('Segment selected', e.detail.value)}> + + + + + + + + + + {/*-- Segment with default selection --*/} + console.log('Segment selected', e.detail.value)} value="javascript"> + + Python + + + Javascript + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/segment/usage/react.md b/core/src/components/segment/usage/react.md new file mode 100644 index 0000000000..a5278373ba --- /dev/null +++ b/core/src/components/segment/usage/react.md @@ -0,0 +1,101 @@ +```tsx +import React from 'react'; + +import { IonSegment, IonSegmentButton, IonLabel, IonIcon, IonToolbar } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Segment --*/} + console.log('Segment selected', e.detail.value)}> + + Friends + + + Enemies + + + + {/*-- Disabled Segment --*/} + console.log('Segment selected', e.detail.value)} disabled> + + Sunny + + + Rainy + + + + {/*-- Segment with anchors --*/} + console.log('Segment selected', e.detail.value)}> + + Dogs + + + Cats + + + + {/*-- Scrollable Segment --*/} + + + + + + + + + + + + + + + + + + + + + + + + + {/*-- Segment with secondary color --*/} + console.log('Segment selected', e.detail.value)} color="secondary"> + + Standard + + + Hybrid + + + Satellite + + + + {/*-- Segment in a toolbar --*/} + + console.log('Segment selected', e.detail.value)}> + + + + + + + + + + {/*-- Segment with default selection --*/} + console.log('Segment selected', e.detail.value)} value="javascript"> + + Python + + + Javascript + + + +); + +export default Example; +``` diff --git a/core/src/components/select/readme.md b/core/src/components/select/readme.md index ec80faa500..cca9f9ad2f 100644 --- a/core/src/components/select/readme.md +++ b/core/src/components/select/readme.md @@ -316,6 +316,143 @@ customActionSheetSelect.interfaceOptions = customActionSheetOptions; ``` +### React + +```tsx +import React from 'react'; + +import { IonList, IonListHeader, IonItem, IonLabel, IonSelect, IonSelectOption } from '@ionic/react'; + +const customAlertOptions = { + header: 'Pizza Toppings', + subHeader: 'Select your toppings', + message: '$1.00 per topping', + translucent: true +}; + +const customPopoverOptions = { + header: 'Hair Color', + subHeader: 'Select your hair color', + message: 'Only select your dominant hair color' +}; + +const customActionSheetOptions = { + header: 'Colors', + subHeader: 'Select your favorite color' +}; + +const Example: React.SFC<{}> = () => ( + <> + ## Single Selection + + + + Single Selection + + + Gender + + Female + Male + + + + + Hair Color + + Brown + Blonde + Black + Red + + + + + + ## Multiple Selection + + + + Multiple Selection + + + Toppings + + Bacon + Black Olives + Extra Cheese + Green Peppers + Mushrooms + Onions + Pepperoni + Pineapple + Sausage + Spinach + + + + + Pets + + Bird + Cat + Dog + Honey Badger + + + + + + ## Interface Options + + + + Interface Options + + + Alert + + Bacon + Black Olives + Extra Cheese + Green Peppers + Mushrooms + Onions + Pepperoni + Pineapple + Sausage + Spinach + + + + + Popover + + Brown + Blonde + Black + Red + + + + + Action Sheet + + Red + Purple + Yellow + Orange + Green + + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/select/usage/react.md b/core/src/components/select/usage/react.md new file mode 100644 index 0000000000..a376f8be84 --- /dev/null +++ b/core/src/components/select/usage/react.md @@ -0,0 +1,133 @@ +```tsx +import React from 'react'; + +import { IonList, IonListHeader, IonItem, IonLabel, IonSelect, IonSelectOption } from '@ionic/react'; + +const customAlertOptions = { + header: 'Pizza Toppings', + subHeader: 'Select your toppings', + message: '$1.00 per topping', + translucent: true +}; + +const customPopoverOptions = { + header: 'Hair Color', + subHeader: 'Select your hair color', + message: 'Only select your dominant hair color' +}; + +const customActionSheetOptions = { + header: 'Colors', + subHeader: 'Select your favorite color' +}; + +const Example: React.SFC<{}> = () => ( + <> + ## Single Selection + + + + Single Selection + + + Gender + + Female + Male + + + + + Hair Color + + Brown + Blonde + Black + Red + + + + + + ## Multiple Selection + + + + Multiple Selection + + + Toppings + + Bacon + Black Olives + Extra Cheese + Green Peppers + Mushrooms + Onions + Pepperoni + Pineapple + Sausage + Spinach + + + + + Pets + + Bird + Cat + Dog + Honey Badger + + + + + + ## Interface Options + + + + Interface Options + + + Alert + + Bacon + Black Olives + Extra Cheese + Green Peppers + Mushrooms + Onions + Pepperoni + Pineapple + Sausage + Spinach + + + + + Popover + + Brown + Blonde + Black + Red + + + + + Action Sheet + + Red + Purple + Yellow + Orange + Green + + + + +); + +export default Example; +``` diff --git a/core/src/components/slides/readme.md b/core/src/components/slides/readme.md index c4b6b1a8a0..55bfe5071e 100644 --- a/core/src/components/slides/readme.md +++ b/core/src/components/slides/readme.md @@ -78,6 +78,35 @@ slides.options = { ``` +### React + +```tsx +import React from 'react'; + +import { IonSlides, IonSlide } from '@ionic/react'; + +const slideOpts = { + effect: 'flip' +}; + +const Example: React.SFC<{}> = () => ( + + +

Slide 1

+
+ +

Slide 2

+
+ +

Slide 3

+
+
+); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/slides/usage/react.md b/core/src/components/slides/usage/react.md new file mode 100644 index 0000000000..9d11433768 --- /dev/null +++ b/core/src/components/slides/usage/react.md @@ -0,0 +1,25 @@ +```tsx +import React from 'react'; + +import { IonSlides, IonSlide } from '@ionic/react'; + +const slideOpts = { + effect: 'flip' +}; + +const Example: React.SFC<{}> = () => ( + + +

Slide 1

+
+ +

Slide 2

+
+ +

Slide 3

+
+
+); + +export default Example; +``` diff --git a/core/src/components/spinner/readme.md b/core/src/components/spinner/readme.md index 63e7e1a067..cbce4b1b78 100644 --- a/core/src/components/spinner/readme.md +++ b/core/src/components/spinner/readme.md @@ -40,6 +40,45 @@ The default spinner to use is based on the platform. The default spinner for `io ``` +### React + +```tsx +import React from 'react'; + +import { IonSpinner } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Spinner --*/} + + + {/*-- Lines --*/} + + + {/*-- Lines Small --*/} + + + {/*-- Dots --*/} + + + {/*-- Bubbles --*/} + + + {/*-- Circles --*/} + + + {/*-- Crescent --*/} + + + {/*-- Paused Default Spinner --*/} + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/spinner/usage/react.md b/core/src/components/spinner/usage/react.md new file mode 100644 index 0000000000..3949397b3f --- /dev/null +++ b/core/src/components/spinner/usage/react.md @@ -0,0 +1,35 @@ +```tsx +import React from 'react'; + +import { IonSpinner } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Spinner --*/} + + + {/*-- Lines --*/} + + + {/*-- Lines Small --*/} + + + {/*-- Dots --*/} + + + {/*-- Bubbles --*/} + + + {/*-- Circles --*/} + + + {/*-- Crescent --*/} + + + {/*-- Paused Default Spinner --*/} + + +); + +export default Example; +``` diff --git a/core/src/components/split-pane/readme.md b/core/src/components/split-pane/readme.md index f404caec89..6345da8537 100644 --- a/core/src/components/split-pane/readme.md +++ b/core/src/components/split-pane/readme.md @@ -82,6 +82,34 @@ SplitPane also provides some predefined media queries that can be used. ``` +### React + +```tsx +import React from 'react'; + +import { IonSplitPane, IonMenu, IonHeader, IonToolbar, IonTitle, IonRouterOutlet } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + {/*-- our side menu --*/} + + + + Menu + + + + + {/*-- the main content --*/} + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/split-pane/usage/react.md b/core/src/components/split-pane/usage/react.md new file mode 100644 index 0000000000..ea3ef85797 --- /dev/null +++ b/core/src/components/split-pane/usage/react.md @@ -0,0 +1,24 @@ +```tsx +import React from 'react'; + +import { IonSplitPane, IonMenu, IonHeader, IonToolbar, IonTitle, IonRouterOutlet } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + {/*-- our side menu --*/} + + + + Menu + + + + + {/*-- the main content --*/} + + +); + +export default Example; +``` diff --git a/core/src/components/tab-bar/readme.md b/core/src/components/tab-bar/readme.md index 35ce13a6de..9a1302bd19 100644 --- a/core/src/components/tab-bar/readme.md +++ b/core/src/components/tab-bar/readme.md @@ -53,6 +53,35 @@ The tab bar is a UI component that contains a set of [tab buttons](../tab-button ``` +### React + +```tsx +import React from 'react'; + +import { IonTabs, IonTabBar, IonTabButton, IonIcon } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + {/*-- Tab bar --*/} + + + + + + + + + + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/tab-bar/usage/react.md b/core/src/components/tab-bar/usage/react.md new file mode 100644 index 0000000000..a98a5558d8 --- /dev/null +++ b/core/src/components/tab-bar/usage/react.md @@ -0,0 +1,25 @@ +```tsx +import React from 'react'; + +import { IonTabs, IonTabBar, IonTabButton, IonIcon } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + {/*-- Tab bar --*/} + + + + + + + + + + + + +); + +export default Example; +``` diff --git a/core/src/components/tab-button/readme.md b/core/src/components/tab-button/readme.md index c7f57447b6..f0e0a05e58 100644 --- a/core/src/components/tab-button/readme.md +++ b/core/src/components/tab-button/readme.md @@ -88,6 +88,46 @@ See the [tabs documentation](../tabs) for more details on configuring tabs. ``` +### React + +```tsx +import React from 'react'; + +import { IonTabs, IonTabBar, IonTabButton, IonIcon, IonLabel } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + + + Schedule + + + + + Speakers + + + + + Map + + + + + About + + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/tab-button/usage/react.md b/core/src/components/tab-button/usage/react.md new file mode 100644 index 0000000000..40601558d1 --- /dev/null +++ b/core/src/components/tab-button/usage/react.md @@ -0,0 +1,36 @@ +```tsx +import React from 'react'; + +import { IonTabs, IonTabBar, IonTabButton, IonIcon, IonLabel } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + + + Schedule + + + + + Speakers + + + + + Map + + + + + About + + + + +); + +export default Example; +``` diff --git a/core/src/components/tabs/readme.md b/core/src/components/tabs/readme.md index 4fb59d565a..88a41a3c99 100644 --- a/core/src/components/tabs/readme.md +++ b/core/src/components/tabs/readme.md @@ -163,6 +163,45 @@ Using tabs with Angular's router is fairly straight forward. Here you only need ``` +### React + +```tsx +import React from 'react'; + +import { IonTabs, IonTabBar, IonTabButton, IonIcon, IonLabel, IonBadge } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + + Schedule + 6 + + + + + Speakers + + + + + Map + + + + + About + + + +); + +export default Example; +``` + + ## Events diff --git a/core/src/components/tabs/usage/react.md b/core/src/components/tabs/usage/react.md new file mode 100644 index 0000000000..9dc4dd37d0 --- /dev/null +++ b/core/src/components/tabs/usage/react.md @@ -0,0 +1,35 @@ +```tsx +import React from 'react'; + +import { IonTabs, IonTabBar, IonTabButton, IonIcon, IonLabel, IonBadge } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + + + + + + Schedule + 6 + + + + + Speakers + + + + + Map + + + + + About + + + +); + +export default Example; +``` diff --git a/core/src/components/textarea/readme.md b/core/src/components/textarea/readme.md index 6866a638fb..1ccf8dbc2e 100644 --- a/core/src/components/textarea/readme.md +++ b/core/src/components/textarea/readme.md @@ -95,6 +95,57 @@ The textarea component accepts the [native textarea attributes](https://develope ``` +### React + +```tsx +import React from 'react'; + +import { IonTextarea, IonItem, IonLabel } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default textarea --*/} + + + {/*-- Textarea in an item with a placeholder --*/} + + + + + {/*-- Textarea in an item with a floating label --*/} + + Description + + + + {/*-- Disabled and readonly textarea in an item with a stacked label --*/} + + Summary + + + + + {/*-- Textarea that clears the value on edit --*/} + + Comment + + + + {/*-- Textarea with custom number of rows and cols --*/} + + Notes + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/textarea/usage/react.md b/core/src/components/textarea/usage/react.md new file mode 100644 index 0000000000..63cbac172f --- /dev/null +++ b/core/src/components/textarea/usage/react.md @@ -0,0 +1,47 @@ +```tsx +import React from 'react'; + +import { IonTextarea, IonItem, IonLabel } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default textarea --*/} + + + {/*-- Textarea in an item with a placeholder --*/} + + + + + {/*-- Textarea in an item with a floating label --*/} + + Description + + + + {/*-- Disabled and readonly textarea in an item with a stacked label --*/} + + Summary + + + + + {/*-- Textarea that clears the value on edit --*/} + + Comment + + + + {/*-- Textarea with custom number of rows and cols --*/} + + Notes + + + +); + +export default Example; +``` diff --git a/core/src/components/thumbnail/readme.md b/core/src/components/thumbnail/readme.md index b44e868e59..ff7f4e5d76 100644 --- a/core/src/components/thumbnail/readme.md +++ b/core/src/components/thumbnail/readme.md @@ -26,6 +26,32 @@ Thumbnails can be used by themselves or inside of any element. If placed inside ``` +### React + +```tsx +import React from 'react'; + +import { IonThumbnail, IonItem, IonLabel } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + + + + + + + Item Thumbnail + + +); + +export default Example; +``` + + ## CSS Custom Properties diff --git a/core/src/components/thumbnail/usage/react.md b/core/src/components/thumbnail/usage/react.md new file mode 100644 index 0000000000..323e913470 --- /dev/null +++ b/core/src/components/thumbnail/usage/react.md @@ -0,0 +1,22 @@ +```tsx +import React from 'react'; + +import { IonThumbnail, IonItem, IonLabel } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + + + + + + + + Item Thumbnail + + +); + +export default Example; +``` diff --git a/core/src/components/toast/readme.md b/core/src/components/toast/readme.md index 0e41ee2cb1..091a3f7c0e 100644 --- a/core/src/components/toast/readme.md +++ b/core/src/components/toast/readme.md @@ -86,6 +86,54 @@ async function presentToastWithOptions() { ``` +### React + +```tsx +import React, { Component } from 'react' +import { IonToast } from '@ionic/react'; + +type Props = {} +type State = { + showToast1: boolean + showToast2: boolean +} + +export class Toast extends Component { + + constructor(props: Props) { + super(props); + this.state = { + showToast1: false + showToast2: false + }; + } + + render() { + return ( + this.setState(() => ({ showToast1: false }))} + message='Your settings have been saved.' + duration={200} + > + + + this.setState(() => ({ showToast2: false }))} + message='Click to Close' + showCloseButton={true} + position='top' + closeButtonText='Done' + > + + ); + } +} + +``` + + ## Properties diff --git a/core/src/components/toast/usage/react.md b/core/src/components/toast/usage/react.md new file mode 100644 index 0000000000..eced288429 --- /dev/null +++ b/core/src/components/toast/usage/react.md @@ -0,0 +1,44 @@ +```tsx +import React, { Component } from 'react' +import { IonToast } from '@ionic/react'; + +type Props = {} +type State = { + showToast1: boolean + showToast2: boolean +} + +export class Toast extends Component { + + constructor(props: Props) { + super(props); + this.state = { + showToast1: false + showToast2: false + }; + } + + render() { + return ( + this.setState(() => ({ showToast1: false }))} + message='Your settings have been saved.' + duration={200} + > + + + this.setState(() => ({ showToast2: false }))} + message='Click to Close' + showCloseButton={true} + position='top' + closeButtonText='Done' + > + + ); + } +} + +``` diff --git a/core/src/components/toggle/readme.md b/core/src/components/toggle/readme.md index 0a2ce182f0..83bfc12acd 100644 --- a/core/src/components/toggle/readme.md +++ b/core/src/components/toggle/readme.md @@ -87,6 +87,55 @@ Toggles change the state of a single option. Toggles can be switched on or off b ``` +### React + +```tsx +import React from 'react'; + +import { IonToggle, IonList, IonItem, IonLabel } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Toggle --*/} + + + {/*-- Disabled Toggle --*/} + + + {/*-- Checked Toggle --*/} + + + {/*-- Toggle Colors --*/} + + + + + + + {/*-- Toggles in a List --*/} + + + Pepperoni + {}}> + + + + Sausage + {}} disabled={true}> + + + + Mushrooms + {}}> + + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/toggle/usage/react.md b/core/src/components/toggle/usage/react.md new file mode 100644 index 0000000000..c5031d11cb --- /dev/null +++ b/core/src/components/toggle/usage/react.md @@ -0,0 +1,45 @@ +```tsx +import React from 'react'; + +import { IonToggle, IonList, IonItem, IonLabel } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + {/*-- Default Toggle --*/} + + + {/*-- Disabled Toggle --*/} + + + {/*-- Checked Toggle --*/} + + + {/*-- Toggle Colors --*/} + + + + + + + {/*-- Toggles in a List --*/} + + + Pepperoni + {}}> + + + + Sausage + {}} disabled={true}> + + + + Mushrooms + {}}> + + + +); + +export default Example; +``` diff --git a/core/src/components/toolbar/readme.md b/core/src/components/toolbar/readme.md index 40f4087ee6..0ad26bea2d 100644 --- a/core/src/components/toolbar/readme.md +++ b/core/src/components/toolbar/readme.md @@ -342,6 +342,175 @@ In `md` mode, the `` will receive a box-shadow on the bottom, and th ``` +### React + +```tsx +import React from 'react'; + +import { IonToolbar, IonTitle, IonButtons, IonBackButton, IonButton, IonIcon, IonMenuButton, IonSearchbar, IonSegment, IonSegmentButton } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + Title Only + + + + + {}} /> + + Back Button + + + + + + + + + + + + + + + + + Default Buttons + + + + + + + Contact + + + Solid Buttons + + + Help + + + + + + + + + + Star + + + Outline Buttons + + + Edit + + + + + + + + + Account + + + + + Edit + + + Text Only Buttons + + + + + + + + + + + + + Left side menu toggle + + + + + {}}> + + + + Right side menu toggle + + + + + + + + + {}}> + + + + + + + + + + All + + + Favorites + + + + + + + + + + + + + + + + + + + Secondary Toolbar + + + + + + + + + + + + + + + + + Dark Toolbar + + +); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/toolbar/usage/react.md b/core/src/components/toolbar/usage/react.md new file mode 100644 index 0000000000..4e49133e6e --- /dev/null +++ b/core/src/components/toolbar/usage/react.md @@ -0,0 +1,165 @@ +```tsx +import React from 'react'; + +import { IonToolbar, IonTitle, IonButtons, IonBackButton, IonButton, IonIcon, IonMenuButton, IonSearchbar, IonSegment, IonSegmentButton } from '@ionic/react'; + +const Example: React.SFC<{}> = () => ( + <> + + Title Only + + + + + {}} /> + + Back Button + + + + + + + + + + + + + + + + + Default Buttons + + + + + + + Contact + + + Solid Buttons + + + Help + + + + + + + + + + Star + + + Outline Buttons + + + Edit + + + + + + + + + Account + + + + + Edit + + + Text Only Buttons + + + + + + + + + + + + + Left side menu toggle + + + + + {}}> + + + + Right side menu toggle + + + + + + + + + {}}> + + + + + + + + + + All + + + Favorites + + + + + + + + + + + + + + + + + + + Secondary Toolbar + + + + + + + + + + + + + + + + + Dark Toolbar + + +); + +export default Example; +``` diff --git a/core/src/components/virtual-scroll/readme.md b/core/src/components/virtual-scroll/readme.md index f40429a56c..679cdb942d 100644 --- a/core/src/components/virtual-scroll/readme.md +++ b/core/src/components/virtual-scroll/readme.md @@ -251,6 +251,76 @@ let rotateImg = 0; ``` +### React + +```tsx +import React from 'react'; + +import { IonContent, IonCard, IonCardHeader, IonCardTitle, IonVirtualScroll } from '@ionic/react'; + +let rotateImg = 0; +const lorem = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, seddo eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'; + +const images = [ + 'bandit', + 'batmobile', + 'blues-brothers', + 'bueller', + 'delorean', + 'eleanor', + 'general-lee', + 'ghostbusters', + 'knight-rider', + 'mirth-mobile' +]; + +function getImgSrc() { + const src = 'https://dummyimage.com/600x400/${Math.round( Math.random() * 99999)}/fff.png'; + rotateImg++; + if (rotateImg === images.length) { + rotateImg = 0; + } + return src; +} + +const items: any[] = []; + +for (let i = 0; i < 1000; i++) { + items.push({ + name: i + ' - ' + images[rotateImg], + imgSrc: getImgSrc(), + avatarSrc: getImgSrc(), + imgHeight: Math.floor(Math.random() * 50 + 150), + content: lorem.substring(0, Math.random() * (lorem.length - 100) + 100) + }); + + rotateImg++; + if (rotateImg === images.length) { + rotateImg = 0; + } +} + +const Example: React.SFC<{}> = () => ( + + + + +
+ item.name +
+ + {{ name }} + + {{ content }} +
+
+
+); + +export default Example; +``` + + ## Properties diff --git a/core/src/components/virtual-scroll/usage/react.md b/core/src/components/virtual-scroll/usage/react.md new file mode 100644 index 0000000000..8c8b596751 --- /dev/null +++ b/core/src/components/virtual-scroll/usage/react.md @@ -0,0 +1,66 @@ +```tsx +import React from 'react'; + +import { IonContent, IonCard, IonCardHeader, IonCardTitle, IonVirtualScroll } from '@ionic/react'; + +let rotateImg = 0; +const lorem = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, seddo eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'; + +const images = [ + 'bandit', + 'batmobile', + 'blues-brothers', + 'bueller', + 'delorean', + 'eleanor', + 'general-lee', + 'ghostbusters', + 'knight-rider', + 'mirth-mobile' +]; + +function getImgSrc() { + const src = 'https://dummyimage.com/600x400/${Math.round( Math.random() * 99999)}/fff.png'; + rotateImg++; + if (rotateImg === images.length) { + rotateImg = 0; + } + return src; +} + +const items: any[] = []; + +for (let i = 0; i < 1000; i++) { + items.push({ + name: i + ' - ' + images[rotateImg], + imgSrc: getImgSrc(), + avatarSrc: getImgSrc(), + imgHeight: Math.floor(Math.random() * 50 + 150), + content: lorem.substring(0, Math.random() * (lorem.length - 100) + 100) + }); + + rotateImg++; + if (rotateImg === images.length) { + rotateImg = 0; + } +} + +const Example: React.SFC<{}> = () => ( + + + + +
+ item.name +
+ + {{ name }} + + {{ content }} +
+
+
+); + +export default Example; +```