Skip to main content

Choice

<sc-choice></sc-choice>

Choice buttons allow selection of a single or multiple options from a set of predefined options. They are a good alternative to radio buttons, checkboxes, and select menus.

info

Choice components must be wrapped in the <sc-choices></sc-choices> component.

Gold Plan$9.99, then $49.99 per monthSilver Plan$39.99 per monthBronze Plan$9.99 per month

Checkbox Type

In addition to a radio style selector, you can also choose a checkbox. This lets you change the behavior from selecting one option from many, to selecting any number of options, or none at all.

Gold Plan$9.99, then $49.99 per monthSilver Plan$39.99 per monthBronze Plan$9.99 per month

Disabled Choices

Gold Plan$9.99, then $49.99 per monthSilver Plan$39.99 per monthBronze Plan$9.99 per month

Component Codex

Properties

PropertyDescriptionTypeDefault
checkedDraws the choice in a checked state.booleanfalse
disabledIs the choice disabledbooleanfalse
invalidThis will be true when the control is in an invalid state. Validity is determined by the `required` prop.booleanfalse
nameThe choice name attributestring
requiredIs this requiredbooleanfalse
showControlShow the radio/checkbox controlbooleantrue
showLabelShow the labelbooleantrue
showPriceShow the pricebooleantrue
sizeThe size."large" | "medium" | "small"'medium'
typeThe choice name attribute"checkbox" | "radio"'radio'
valueThe choice valuestring

Events

EventDescriptionType
scBlurEmitted when the control loses focus.CustomEvent<void>
scChangeEmitted when the control's checked state changes.CustomEvent<boolean>
scFocusEmitted when the control gains focus.CustomEvent<void>

Methods

reportValidity() => Promise<boolean>

Checks for validity and shows the browser's validation message if the control is invalid.

setCustomValidity(message: string) => Promise<void>

Sets a custom validation message. If `message` is not empty, the field will be considered invalid.

triggerClick() => Promise<void>

Simulates a click on the choice.

triggerFocus() => Promise<void>

Shadow Parts

PartDescription
base
checked-icon
content
control
description
label
title