Group
Places related items side by side, and can join their edges into one control.
Usage
import { Group } from '@leverui/components';
export function GroupUsage() {
return (
<Group>
<div />
<div />
</Group>
);
}
Examples
Button
Here's an example of using the Group component to group buttons together.
Attached
Use the attached prop to attach the children together.
Note: When composing custom components in an attached Group, forward their props to the native control.
import '@leverui/components/styles.css';
import { type JSX } from '@solidjs/web';
import { Button, Group, type ButtonProps } from '@leverui/components';
/** Forward button props so the custom control keeps its native behavior. */
function FocusButton(props: ButtonProps): JSX.Element {
return <Button variant="outline" {...props}>Focus</Button>;
}
/** Attach a custom button to another control. */
export function GroupWithCustomButton(): JSX.Element {
return (
<Group attached>
<FocusButton />
<Button variant="outline">Two</Button>
</Group>
);
}
Grow
Use the grow prop to make the children grow to fill the available space.
Props
| Prop | Default | Type | Description |
|---|---|---|---|
as | div | Native HTML tag | HTML tag to render. |
asChild | — | Solid render callback | Render your own element in place of the default. |
Children sit in one row by default. orientation="vertical" stacks them.
attached joins the children's edges. grow makes them share the available
width. align, justify, and wrap control the flex layout.
stacking="first-on-top" and "last-on-top" set which child sits on top where
children overlap. A skip function leaves a direct child out of the joined
edges and the stacking order.
Responsive: orientation, attached, grow, and stacking.
Variables: --leverui-group-gap for spacing, --leverui-group-align,
--leverui-group-justify, and --leverui-group-wrap.
Layout only. Group adds no shared keyboard or selection behavior, so give
each control its own accessible name and behavior.