Control Group
An input or a select joined with its buttons into one control: shared borders, the outer corners rounded, in the look of the app's style. Text and input groups join in too.
Usage
import { Component, ViewEncapsulation } from '@angular/core';import { ScButton, ScControlGroup, ScInput } from '@semantic-components/ui';
@Component({ selector: 'app-control-group-usage-demo', imports: [ScButton, ScControlGroup, ScInput], template: ` <div scControlGroup aria-label="Newsletter"> <input scInput type="email" placeholder="Email" aria-label="Email" autocomplete="email" /> <button scButton variant="outline">Subscribe</button> </div> `, host: { class: 'flex w-full justify-center' }, encapsulation: ViewEncapsulation.None,})export class ControlGroupUsageDemo {}Anatomy
A group on a div, its children what you put in it: inputs, selects, text, buttons, input groups, other groups. Name it with aria-label: it is announced as a group.
import { ScControlGroup, ScControlGroupSeparator, ScControlGroupText,} from '@semantic-components/ui';<div scControlGroup aria-label="…"> <label scControlGroupText for="…">Text</label> <input scInput id="…" /> <button scButton variant="outline">Button</button> <div scControlGroupSeparator></div> <button scButton variant="outline">Button</button></div>shadcn's Button Group
This is shadcn's Button Group, under a name for what it is for: joining an input or a select with its buttons. Its look, class for class, and its parts are shadcn's. It joins buttons alone too — vertically, in three sizes, with a separator, as a split button, with a menu or a popover: those examples are on the Button page.
Tab goes to each control. For buttons that toggle a state, use a Toggle Group; for a row of controls moved between with the arrow keys, a Toolbar.
Examples
Input
import { Component, ViewEncapsulation } from '@angular/core';import { ScButton, ScControlGroup, ScInput } from '@semantic-components/ui';import { SiSearchIcon } from '@semantic-icons/lucide-icons';
@Component({ selector: 'app-input-control-group-demo', imports: [ScButton, ScControlGroup, ScInput, SiSearchIcon], template: ` <div scControlGroup aria-label="Search"> <input scInput placeholder="Search..." aria-label="Search" />Text
import { Component, ViewEncapsulation } from '@angular/core';import { ScButton, ScControlGroup, ScControlGroupText, ScInput,} from '@semantic-components/ui';
@Component({ selector: 'app-text-control-group-demo',Select
import { Component, ViewEncapsulation, signal } from '@angular/core';import { FormField, FormRoot, form } from '@angular/forms/signals';import { ScButton, ScControlGroup, ScInput, ScSelect, ScSelectIcon, ScSelectItem, ScSelectItemIndicator,Input Group
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScButton, ScControlGroup, ScInput, ScInputGroup, ScInputGroupAddon, ScTooltip, ScTooltipArrow, ScTooltipPortal,Nested
import { Component, ViewEncapsulation } from '@angular/core';import { ScButton, ScControlGroup, ScInput, ScInputGroup, ScInputGroupAddon, ScTooltip, ScTooltipArrow, ScTooltipPortal,RTL
import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation, signal } from '@angular/core';import { FormField, FormRoot, form } from '@angular/forms/signals';import { ScButton, ScControlGroup, ScInput, ScSelect, ScSelectIcon, ScSelectItem,API reference
ScControlGroup — div[scControlGroup]
The group: role="group", its classes the style’s. A group in a group is spaced from the others.
| Input | Type | Default | Description |
|---|---|---|---|
orientation | 'horizontal' | 'vertical' | 'horizontal' | Side by side, or stacked. |
class | string | '' | Classes merged over the style (cn: a later class wins). |
ScControlGroupText — div[scControlGroupText], label[scControlGroupText]
Text beside the buttons. On a label, it names the input it is for.
| Input | Type | Default | Description |
|---|---|---|---|
class | string | '' | Classes merged over the style (cn: a later class wins). |
ScControlGroupSeparator — div[scControlGroupSeparator]
A line between two buttons of the same look (secondary ones: they have no border); see the Button page’s Group Separator and Split Button.
| Input | Type | Default | Description |
|---|---|---|---|
orientation | 'horizontal' | 'vertical' | 'vertical' | Vertical between buttons side by side; horizontal in a stacked group. |
class | string | '' | Classes merged over the style (cn: a later class wins). |