diff --git a/packages/react-core/src/components/Radio/examples/Radio.md b/packages/react-core/src/components/Radio/examples/Radio.md index 2fe14ab9c43..fe26623a9fa 100644 --- a/packages/react-core/src/components/Radio/examples/Radio.md +++ b/packages/react-core/src/components/Radio/examples/Radio.md @@ -7,104 +7,48 @@ ouia: true --- ## Examples + ### Controlled -```js -import React from 'react'; -import { Radio } from '@patternfly/react-core'; - -class ControlledRadio extends React.Component { - constructor(props) { - super(props); - this.state = { - check1: false, - }; - - this.handleChange = (_, event) => { - const { value } = event.currentTarget; - this.setState({ [value]: true }); - }; - } - - render() { - return ( - - - - ); - } -} + +```ts file="./RadioControlled.tsx" ``` ### Uncontrolled -```js -import React from 'react'; -import { Radio } from '@patternfly/react-core'; - +```ts file="./RadioUncontrolled.tsx" ``` ### Reversed -```js -import React from 'react'; -import { Radio } from '@patternfly/react-core'; - +```ts file="./RadioReversed.tsx" ``` ### Label wraps -```js -import React from 'react'; -import { Radio } from '@patternfly/react-core'; - +```ts file="./RadioLabelWraps.tsx" ``` ### Disabled -```js -import React from 'react'; -import { Radio } from '@patternfly/react-core'; - - - - - + +```ts file="./RadioDisabled.tsx" ``` ### With description -```js -import React from 'react'; -import { Radio } from '@patternfly/react-core'; - +```ts file="./RadioWithDescription.tsx" ``` ### With body -```js -import React from 'react'; -import { Radio } from '@patternfly/react-core'; - +```ts file="./RadioWithBody.tsx" ``` ### With description and body -```js -import React from 'react'; -import { Radio } from '@patternfly/react-core'; - +```ts file="./RadioWithDescriptionAndBody.tsx" ``` ### Standalone input -```js -import React from 'react'; -import { Radio } from '@patternfly/react-core'; - +```ts file="./RadioStandaloneInput.tsx" ``` diff --git a/packages/react-core/src/components/Radio/examples/RadioControlled.tsx b/packages/react-core/src/components/Radio/examples/RadioControlled.tsx new file mode 100644 index 00000000000..957da3eb7e0 --- /dev/null +++ b/packages/react-core/src/components/Radio/examples/RadioControlled.tsx @@ -0,0 +1,21 @@ +import React from 'react'; +import { Radio } from '@patternfly/react-core'; + +export const RadioControlled: React.FunctionComponent = () => { + const [check1, setCheck1] = React.useState(false); + + const handleChange = () => { + setCheck1(true); + }; + return ( + + + + ); +}; diff --git a/packages/react-core/src/components/Radio/examples/RadioDisabled.tsx b/packages/react-core/src/components/Radio/examples/RadioDisabled.tsx new file mode 100644 index 00000000000..08183cb58b4 --- /dev/null +++ b/packages/react-core/src/components/Radio/examples/RadioDisabled.tsx @@ -0,0 +1,15 @@ +import React from 'react'; +import { Radio } from '@patternfly/react-core'; + +export const RadioDisabled: React.FunctionComponent = () => ( + + + + +); diff --git a/packages/react-core/src/components/Radio/examples/RadioLabelWraps.tsx b/packages/react-core/src/components/Radio/examples/RadioLabelWraps.tsx new file mode 100644 index 00000000000..c7888590b8f --- /dev/null +++ b/packages/react-core/src/components/Radio/examples/RadioLabelWraps.tsx @@ -0,0 +1,6 @@ +import React from 'react'; +import { Radio } from '@patternfly/react-core'; + +export const RadioLabelWraps: React.FunctionComponent = () => ( + +); diff --git a/packages/react-core/src/components/Radio/examples/RadioReversed.tsx b/packages/react-core/src/components/Radio/examples/RadioReversed.tsx new file mode 100644 index 00000000000..5c0951955da --- /dev/null +++ b/packages/react-core/src/components/Radio/examples/RadioReversed.tsx @@ -0,0 +1,6 @@ +import React from 'react'; +import { Radio } from '@patternfly/react-core'; + +export const RadioReversed: React.FunctionComponent = () => ( + +); diff --git a/packages/react-core/src/components/Radio/examples/RadioStandaloneInput.tsx b/packages/react-core/src/components/Radio/examples/RadioStandaloneInput.tsx new file mode 100644 index 00000000000..4f0aac7f8e1 --- /dev/null +++ b/packages/react-core/src/components/Radio/examples/RadioStandaloneInput.tsx @@ -0,0 +1,6 @@ +import React from 'react'; +import { Radio } from '@patternfly/react-core'; + +export const RadioStandaloneInput: React.FunctionComponent = () => ( + +); diff --git a/packages/react-core/src/components/Radio/examples/RadioUncontrolled.tsx b/packages/react-core/src/components/Radio/examples/RadioUncontrolled.tsx new file mode 100644 index 00000000000..da70f382536 --- /dev/null +++ b/packages/react-core/src/components/Radio/examples/RadioUncontrolled.tsx @@ -0,0 +1,6 @@ +import React from 'react'; +import { Radio } from '@patternfly/react-core'; + +export const RadioUncontrolled: React.FunctionComponent = () => ( + +); diff --git a/packages/react-core/src/components/Radio/examples/RadioWithBody.tsx b/packages/react-core/src/components/Radio/examples/RadioWithBody.tsx new file mode 100644 index 00000000000..804550d5ad0 --- /dev/null +++ b/packages/react-core/src/components/Radio/examples/RadioWithBody.tsx @@ -0,0 +1,6 @@ +import React from 'react'; +import { Radio } from '@patternfly/react-core'; + +export const RadioWithBody: React.FunctionComponent = () => ( + +); diff --git a/packages/react-core/src/components/Radio/examples/RadioWithDescription.tsx b/packages/react-core/src/components/Radio/examples/RadioWithDescription.tsx new file mode 100644 index 00000000000..2e92b7795b7 --- /dev/null +++ b/packages/react-core/src/components/Radio/examples/RadioWithDescription.tsx @@ -0,0 +1,11 @@ +import React from 'react'; +import { Radio } from '@patternfly/react-core'; + +export const RadioWithDescription: React.FunctionComponent = () => ( + +); diff --git a/packages/react-core/src/components/Radio/examples/RadioWithDescriptionAndBody.tsx b/packages/react-core/src/components/Radio/examples/RadioWithDescriptionAndBody.tsx new file mode 100644 index 00000000000..c50158c3968 --- /dev/null +++ b/packages/react-core/src/components/Radio/examples/RadioWithDescriptionAndBody.tsx @@ -0,0 +1,12 @@ +import React from 'react'; +import { Radio } from '@patternfly/react-core'; + +export const RadioWithDescriptionAndBody: React.FunctionComponent = () => ( + +);