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

disable radio group option #1111

Merged
merged 3 commits into from
Aug 13, 2018
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `3.5.1`.
- Added `disabled` to `EuiRadioGroup.options` ([#1111](https://github.com/elastic/eui/pull/1111))

## [`3.5.1`](https://github.com/elastic/eui/tree/v3.5.1)

Expand Down
1 change: 1 addition & 0 deletions src-docs/src/views/form_controls/radio_group.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default class extends Component {
}, {
id: `${idPrefix}2`,
label: 'Option three',
disabled: true,
}];

this.state = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ exports[`EuiRadioGroup props options are rendered 1`] = `
>
<input
class="euiRadio__input"
disabled=""
id="2"
type="radio"
/>
Expand Down
3 changes: 2 additions & 1 deletion src/components/form/radio/radio_group.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const EuiRadioGroup = ({
checked={option.id === idSelected}
label={option.label}
value={option.value}
disabled={disabled}
disabled={disabled || option.disabled}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The options propType needs the disabled boolean property to be added.

onChange={onChange.bind(null, option.id, option.value)}
compressed={compressed}
/>
Expand All @@ -39,6 +39,7 @@ EuiRadioGroup.propTypes = {
id: PropTypes.string.isRequired,
label: PropTypes.node,
value: PropTypes.string,
disabled: PropTypes.bool,
}),
).isRequired,
idSelected: PropTypes.string,
Expand Down
2 changes: 1 addition & 1 deletion src/components/form/radio/radio_group.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('EuiRadioGroup', () => {
<EuiRadioGroup
options={[
{ id: '1', label: 'Option #1' },
{ id: '2', label: 'Option #2' }
{ id: '2', label: 'Option #2', disabled: true }
]}
onChange={() => {}}
/>
Expand Down