Skip to content

Checkbox Specification

Stefan Ivanov edited this page Jul 22, 2021 · 6 revisions

Checkbox Specification

Contents

  1. Overview
  2. User Stories
  3. Functionality
  4. Test Scenarios
  5. Accessibility

Owned by

Team Name: Phoenix

Developer: Zdravko Kolev

Designer: Stefan Ivanov

Requires approval from

  • Simeon Simeonov | Date:

Signed off by

  • Product Owner: Radoslav Mirchev | Date:
  • Radoslav Karaivanov | Date:

Revision History

Version Users Date Notes
1 Zdravko Kolev Date 2 Feb 2017 Initial spec
1.1 Konstantin Dinev Date 18 Mar 2021 Adding missing properties
2 Stefan Ivanov Date 21 Jul 2021 Update spec template

The <igx-checkbox> component is used to provide a capability for making a binary choice for a certain condition. It follows the native browser checkbox element and behaves in the same way.

Objectives

It is providing API for the most common use cases when it comes to making a binary choice for a certain condition.

Acceptance criteria

  1. The checkbox component should have a toggle visual representation.
  2. The checkbox component should have a clickable box.
  3. The checkbox component should be identifiable via a property, like name.
  4. The checkbox component should represent a unit of information, like value.
  5. The checkbox component should provide a way to be disabled.
  6. The checkbox component should provide a way to be a required field.
  7. The checkbox component should have an indeterminate state.
  8. The checkbox component should have the ability to add a corresponding label (before or after).
  9. The checkbox component should be interacted via mouse and/or keyboard.
  10. The checkbox component should be accessible.
  11. The checkbox component should emit an event when it gains focus.
  12. The checkbox component should emit an event when it loses focus.
  13. The checkbox component should emit an event when its checked status changes.
  14. The checkbox 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 provide a way to display a binary choice - true or false.
  • Story 2: As a developer, I want to be able to name the checkbox, so that I can easily identify it when used with other selection controls of the same type.
  • Story 3: As a developer, I want to be able to set the value of the checkbox, so that I can associate a piece of information with it.
  • Story 4: As a developer, I want to be able to specify the default state of the checkbox - checked, unchecked, or indeterminate.
  • Story 5: As a developer, I want to be able to disable the checkbox, so that the user cannot change its state.
  • Story 6: As a developer, I want to be able to place content between the opening and closing brackets of the checkbox component, so that it can be used as a corresponding label.
  • Story 7: As a developer, I want to be able to position the label of the checkbox either before or after the control, so that it better suits the design.
  • Story 8: As a developer, I want to be able to programmatically click the checkbox, so that I can interact with it via means other than a computer mouse.
  • Story 9: As a developer, I want to be able to programmatically focus the checkbox, so that I can manually trigger the focus event.
  • Story 10: As a developer, I want to be able to programmatically blur the checkbox, so that I can manually trigger the blur event.
  • Story 11: As a developer, I want to be able to listen to blur, focus, and change events, so that I can better manage the state of the checkbox component.
  • Story 12: As a developer, I want to be able to check the validity of the checkbox, so that I can handle form errors and/or warnings.
  • Story 13: As a developer, I want to be able to set a custom validation message, so that the users can easily identify and fix form errors and/or warnings.
  • Story 14: As a developer, I want to be able to customize the appearance of the checkbox component, so that it better fits the design language of my application.

End-user stories:

  • Story 1: As an end-user, I want to be shown a visual representation of certain state changes.
  • Story 2: As an end-user, I want to be able to identify if a checkbox is disabled or not.
  • Story 3: As an end-user, I want to be able to identify if a checkbox is checked, unchecked, or indeterminate.
  • 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.

3.1. End-User Experience

The checkbox component represents a small square box that changes its appearance according to the checkbox state. When unchecked, the box has only an outline. Changing the checkbox state to checked or indeterminate, the box became filled and an icon appears inside - a tick mark for checked state and a dash for the indeterminate. The checkbox component comes with an optional corresponding label that can be position either before or after the selection control. The user can click on both the box and the label to change the state of the checkbox.

3.2. Developer Experience

<igx-checkbox [checked]="task.done" (change)="handler($event)">
    {{ task.label }}
</igx-checkbox>

3.3. API

Properties

You should be able to configure the igx-checkbox by setting its properties:

Name Description Type Default value Reflected
name Sets the name of the checkbox string -
value Sets the value of the checkbox string -
checked Sets the initial state of the checkbox to checked boolean false
indeterminate Sets the initial state of the checkbox to indeterminate boolean false
disabled Sets the accessibility state of the checkbox boolean false
disableRipple Enables/Disables the ripple effect boolean false
disableTransitions Sets/gets whether the checkbox should disable all css transitions boolean false
focused Sets/gets whether the checkbox component is on focus boolean false
readonly Sets/gets whether the checkbox is readonly boolean false
required Makes the checkbox a required field boolean false
label-position Sets the label postion of the checkbox string after

Events

The igx-checkbox should emit the following events:

Name Description Type
change Emitted when the checkbox changes its checked state -

Methods

The igx-checkbox exposes the following methods:

Name Description Arguments
toggle If disabled is false, switches the checked state. -

Automation

  • Scenario 1: Should set the checkbox checked state correctly.
  • Scenario 2: Should set the checkbox disabled state correctly.
  • Scenario 3: Should set the checkbox required option correctly.
  • Scenario 4: Should change the checkbox icon correctly.
  • Scenario 5: Should position the checkbox label correctly.
  • Scenario 6: Should set the checkbox validity correctly.
  • Scenario 7: Should emit event when the checkbox checked state changes.
  • Scenario 8: Should emit events when the checkbox gains or loses focus.
Clone this wiki locally