@synergy-design-system/components
Version:
59 lines (58 loc) • 2.37 kB
TypeScript
import { type CSSResultGroup } from 'lit';
import SynergyElement from '../../internal/synergy-element.js';
/**
* @summary Radios buttons allow the user to select a single option from a group using a button-like control.
* @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-radio-button--docs
* @status stable
* @since 3.17.0
*
* @slot - The radio button's label.
* @slot prefix - A presentational prefix icon or similar element.
* @slot suffix - A presentational suffix icon or similar element.
*
* @event syn-blur - Emitted when the button loses focus.
* @event syn-focus - Emitted when the button gains focus.
*
* @csspart base - The component's base wrapper.
* @csspart button - The internal `<button>` element.
* @csspart button--checked - The internal button element when the radio button is checked.
* @csspart prefix - The container that wraps the prefix.
* @csspart label - The container that wraps the radio button's label.
* @csspart suffix - The container that wraps the suffix.
*/
export default class SynRadioButton extends SynergyElement {
static styles: CSSResultGroup;
private readonly hasSlotController;
input: HTMLInputElement;
defaultSlot: HTMLSlotElement;
protected hasFocus: boolean;
private iconOnly;
/**
* @internal The radio button's checked state. This is exposed as an "internal" attribute so we can reflect it, making
* it easier to style in button groups.
*/
checked: boolean;
/** The radio's value. When selected, the radio group will receive this value. */
value: string | number;
/** Disables the radio button. */
disabled: boolean;
/** Sets the radio button to a readonly state. */
readonly: boolean;
/**
* The radio button's size. When used inside a radio group, the size will be determined by the radio group's size so
* this attribute can typically be omitted.
*/
size: 'small' | 'medium' | 'large';
connectedCallback(): void;
private isDisabled;
private handleBlur;
private handleClick;
private handleFocus;
private handleSlotChange;
handleDisabledChange(): void;
/** Sets focus on the radio button. */
focus(options?: FocusOptions): void;
/** Removes focus from the radio button. */
blur(): void;
render(): import("lit").TemplateResult<1>;
}