Redpanda UIRedpanda UI

Group

A layout component that groups related form elements together.

Made by eblairmckee

Installation

Loading component...

Usage

import { Group } from "@/components/ui/group"
import { Group } from "@/components/ui/group"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"

export function GroupExample() {
  return (
    <Group>
      <Input placeholder="Enter value..." />
      <Select defaultValue="option1">
        <SelectTrigger className="w-[120px]">
          <SelectValue />
        </SelectTrigger>
        <SelectContent>
          <SelectItem value="option1">Option 1</SelectItem>
          <SelectItem value="option2">Option 2</SelectItem>
          <SelectItem value="option3">Option 3</SelectItem>
        </SelectContent>
      </Select>
      <Button>Submit</Button>
    </Group>
  )
}

Examples

Basic Group

Loading component...

Attached Group

Loading component...

API Reference

Group

PropTypeDefaultDescription
childrenReactNode-The form elements to group together
classNamestring-Additional CSS classes to apply to the group container
attachedbooleanfalseWhether to visually connect the grouped elements

Usage with useGroup hook

Components within a Group can access group context using the useGroup hook:

import { useGroup } from "@/components/ui/group"

function MyCustomInput() {
  const { position, attached } = useGroup()
  
  // position will be 'first', 'middle', 'last', or undefined
  // attached indicates if the group is in attached mode
}

When to use

  • Form workflows: Group related inputs, selects, and buttons in forms
  • Search interfaces: Combine search input with filters and action buttons
  • Toolbar layouts: Group related action buttons together
  • Data entry: Combine inputs with associated controls like dropdowns or buttons

Best Practices

  • Use attached={true} when you want elements to visually connect as a single unit
  • Use the default unattached mode when elements are related but should remain visually separate
  • Keep groups to 2-4 elements for optimal user experience
  • Ensure proper spacing and alignment within grouped elements

Credits

  • Inspired by button groups and form layouts from modern design systems
  • Built specifically for the Redpanda UI Registry

Recent changes

  • patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested b…#133
  • minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
  • minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
  • majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
  • patchv0.3.1**Accordion** - `AccordionTrigger` now shows `cursor-pointer` on hover.#112
See full history →
Built by malinskibeniamin. The source code is available on GitHub.

On this page