-
Notifications
You must be signed in to change notification settings - Fork 7
Radio Specification
- Overview
- User Stories
- Functionality
- Test Scenarios
- Accessibility
- Assumptions and Limitations
- References
Team Name: Design and Web Development (DnD)
Developer: Simeon Simeonoff
Designer: Stefan Ivanov
- Diyan Dimitrov | Date:
- Product Owner: Radoslav Mirchev | Date:
- Radoslav Karaivanov | Date:
| Version | Users | Date | Notes |
|---|---|---|---|
| 1 | Simeon Simeonoff | Date 16 Jul 2021 | Initial Proposal |
The igc-radio component renders a single radio button. Radio buttons aren't useful on their own and are usually a part of a bigger unit or group (see igc-radio-group) of radio buttons.
Provide an API for the most common use cases when selecting an option from a set of available options. The igc-radio button should also provide ways to set and get its validity when used in the context of Web Forms.
- The radio button component should be identifiable via a property, like name.
- The radio button component should represent a unit of information, like value.
- The radio button component should provide a way to be disabled.
- The radio button component should be interacted with via mouse and/or keyboard.
- The radio button component should be accessible.
- The radio button component should have an optional label.
- The radio button component should emit an event when it gains focus.
- The radio button component should emit an event when it loses focus.
- The radio button component should emit an event when its checked status changes.
- The radio button component should be able to report validation errors in the context of web forms.
Developer stories
- Story 1: As a developer, I want to be able to
namethe radio button so that I can easily identify it in when used with other buttons of the same type. - Story 2: As a developer, I want to be able to set the
valueof the radio button so that I can associate a piece of information with a it. - Story 3: As a developer, I want to be able to
disablethe radio button so that the user is not able to select that button. - Story 4: As a developer, I want to be able to change the
checkedstate of the radio button declaratively so that the button is selected at initialization. - Story 5: As a developer, I want to be able to change the
invalidstate of the radio button declaratively so that I set set its validity at initialization. - Story 6: As a developer, I want to be able to programmatically click the radio button so that I can interact with it via means other than a computer mouse.
- Story 7: As a developer, I want to be able to programmatically focus the radio button so that I can manually trigger focus.
- Story 8: As a developer, I want to be able to programmatically blur the radio button so that I can manually trigger blur.
- Story 9: As a developer, I want to be able to listen to
blur,focus, andchangeevents so that I can better manage the state of the radio button. - Story 10: As a developer, I want to be able to check the validity of the radio button so that I can handle form errors and/or warnings.
- Story 11: As a developer, I want to be able to set a custom validation message so that the users of the radio button can easily identify and fix form errors and/or warnings.
- Story 12: As a developer, I want to be able to customize the appearance of the radio button so that it better fits the design language of my application.
End-user stories
- Story 1: As an end-user, I want to be able to identify if a radio button is disabled or not.
- Story 2: As an end-user, I want to be able to select a radio button in a group of other buttons via the arrow keys on my keyboard or my computer mouse.
- Story 3: As an end-user, I want to be able to able to differentiate between selected and deselected radio buttons.
- Story 4: As an end-user, I want to be able to identify the option I am selecting via label or some other visual aid.
- Story 5: As an end-user, I want to be able to identify if my selection is valid.
The radio button component is small and circular in shape. When selected it is represented by a concentric circle with two rings where the inner ring is filled. A deselected radio button is represented by a single outlined circle. The radio button can have an optional label that makes it easy do identify when used in a radio group. The user can click on either the circle or the label to select the radio button. Navigating between radio buttons in a group using the arrow keys on a keyboard also changes the currently selected radio button.
3.2.1 Standalone Usage (impractical):
<igc-radio value="banana" checked>Label</igc-radio>3.2.2 Group Usage (intended):
<igc-radio-group>
<igc-radio value="apple" checked>Apple</igc-radio>
<igc-radio value="banana">Banana</igc-radio>
<igc-radio value="mango">Mango</igc-radio>
<igc-radio value="orange" disabled>Orange</igc-radio>
</igc-radio-group>You should be able to configure the igc-radio by setting its properties:
| Name | Description | Type | Default value | Reflected |
|---|---|---|---|---|
name |
Sets the name of the radio button. | string | - | false |
value |
Sets the value of the radio button. | string | - | false |
checked |
Sets the checked state of the radio button. | Boolean | false |
true |
disabled |
Sets the disabled state of the avatar. | Boolean | false |
true |
invalid |
Sets the validity of the radio button. | Boolean | false |
true |
The igc-radio emits the following events:
| Name | Description | Type |
|---|---|---|
igc-focus |
Emitted when the radio button gains focus. | - |
igc-blur |
Emitted when the radio button loses focus. | - |
igc-change |
Emitted when the radio button changes its checked state | - |
The igc-radio exposes the following methods:
| Name | Description | Arguments |
|---|---|---|
click |
Simulates a click on the radio button. | - |
focus |
Sets the radio on focus. | options: FocusOptions |
blur |
Removes the focus from the radio | - |
reportValidity |
Checks for validity and shows a validation message if the component is invalid. | - |
setCustomValidity |
Sets a custom validation message. If message is not empty, the field will be considered invalid. | message: string |
| Name | Description |
|---|---|
| (default) | The radio label. |
| Name | Description |
|---|---|
| base | The radio button base wrapper. |
| control | The radio button control. |
| label | The radio button label. |
Aria attributes set on the input control: