Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

docs(Checkbox): add examples of reversed and label wraps #10318

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/react-core/src/components/Checkbox/examples/Checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ propComponents: ['Checkbox']

```

### Reversed

```ts file="./CheckboxReversed.tsx"

```

### Label wraps

You can expand the clickable area of a checkbox so that it spans wider than the checkbox label by adding the `isLabelWrapped` property. This allows users to select a checkbox by clicking the checkbox itself, the label, or the area between the checkbox and the label.

```ts file="./CheckboxLabelWraps.tsx"

```

### Disabled

```ts file='./CheckboxDisabled.tsx'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';
import { Checkbox } from '@patternfly/react-core';

export const CheckboxLabelWraps: React.FunctionComponent = () => (
<Checkbox
isLabelWrapped
label="Label wraps input example"
id="checkbox-label-wraps-input"
thatblindgeye marked this conversation as resolved.
Show resolved Hide resolved
name="checkbox-label-wraps-input"
/>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
import { Checkbox } from '@patternfly/react-core';

export const CheckboxReversed: React.FunctionComponent = () => (
<Checkbox isLabelBeforeButton label="Reversed checkbox example" id="checkbox-reversed" name="checkbox-reversed" />
);
11 changes: 11 additions & 0 deletions packages/react-core/src/components/Radio/examples/Radio.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,55 @@ ouia: true
### Controlled

```ts file="./RadioControlled.tsx"

```

### Uncontrolled

```ts file="./RadioUncontrolled.tsx"

```

### Reversed

```ts file="./RadioReversed.tsx"

```

### Label wraps

You can expand the clickable area of a radio so that it spans wider than the radio label by adding the `isLabelWrapped` property. This allows users to select a radio by clicking the radio itself, the label, or the area between the radio and the label.

```ts file="./RadioLabelWraps.tsx"

```

### Disabled

```ts file="./RadioDisabled.tsx"

```

### With description

```ts file="./RadioWithDescription.tsx"

```

### With body

```ts file="./RadioWithBody.tsx"

```

### With description and body

```ts file="./RadioWithDescriptionAndBody.tsx"

```

### Standalone input

```ts file="./RadioStandaloneInput.tsx"

```
Loading