UIPin
ComponentsIconsIllustrationsMotionTemplatesApps
Boards
UIPin

Free, open-source UI components, icons, illustrations, motion, templates and apps, in one search. Every item links to its source and licence.

UIPin is free. If it saved you time, you can keep it running:

Buy me a coffee
ComponentsIconsIllustrationsMotionTemplatesAppsLibrariesCompareNew this weekMCP for agentsBoardsPrivacy

Components, icons and artwork belong to their authors and are shown under their open-source licences.

8bitcn/8-bit Button Group

Buttons
1 of 23
Compiling

Theme it

Every preview, live

Brand colour

Corner radius

Font

Recolours shadcn’s tokens, Tailwind’s accent colours and colours set in the code. Red, amber and green classes stay, since they usually mean error, warning or success.

23 versions·7 librariesCompare all button groups →

  • 8-bit Button Group
  • Button group
  • Button Group
  • 8-bit Button
  • Bg Animate Button
  • Cosmic Button
  • Family Button
  • Eldora UI
  • Button
  • Attract Button
  • Bell Button
  • Command Button
  • Gradient Button
  • Hold Button
  • Switch Button
  • Tear Button
  • V0 Button
  • Interactive Hover Button
  • Pulsating Button
  • Rainbow Button
  • Shimmer Button
  • Button
  • Toggle Group

8-bit Button Group

Groups multiple 8-bit buttons together inside a shared retro pixelated border.

npx shadcn@latest add https://www.8bitcn.com/r/button-group.json
Open in v0 Docs Repo
Library
8bitcn
License
MIT
Stack
React · Tailwind CSS · radix
Packages
cnradix-ui
Also adds
button, button-group, separator
Size
304 lines

Code

components/ui/8bit/button-group.tsx

import type * as React from "react";

import { cn } from "@/lib/utils";

import {
  ButtonGroup as ShadcnButtonGroup,
  ButtonGroupText as ShadcnButtonGroupText,
  buttonGroupVariants,
} from "@/components/ui/button-group";

import "@/components/ui/8bit/styles/retro.css";

export { buttonGroupVariants };

// ─── ButtonGroup ──────────────────────────────────────────────────────────────

export type BitButtonGroupProps = React.ComponentProps<
  typeof ShadcnButtonGroup
>;

/**
 * 8-bit ButtonGroup wraps the shadcn ButtonGroup and adds a shared retro
 * pixelated border around the whole group.
 *
 * API matches shadcn: `orientation`, `data-slot="button-group"`.
 * No React context — child button sizing and layout is handled via CSS
 * child selectors in `buttonGroupVariants`, identical to shadcn.
 */
function ButtonGroup({
  className,
  orientation = "horizontal",
  children,
  ...props
}: BitButtonGroupProps) {
  return (
    <div
      className={cn(
        "relative inline-flex",
        orientation === "vertical" ? "flex-col" : "flex-row"
      )}
    >
      {/* Shared outer pixelated border */}
      {/* Top */}
      <div className="absolute -top-1.5 left-1.5 right-1.5 h-1.5 bg-foreground dark:bg-ring pointer-events-none z-10" />
      {/* Bottom */}
      <div className="absolute -bottom-1.5 left-1.5 right-1.5 h-1.5 bg-foreground dark:bg-ring pointer-events-none z-10" />
      {/* Left */}
      <div className="absolute -left-1.5 top-1.5 bottom-1.5 w-1.5 bg-foreground dark:bg-ring pointer-events-none z-10" />
      {/* Right */}
      <div className="absolute -right-1.5 top-1.5 bottom-1.5 w-1.5 bg-foreground dark:bg-ring pointer-events-none z-10" />
      {/* Corners */}
      <div className="absolute top-0 left-0 size-1.5 bg-foreground dark:bg-ring pointer-events-none z-10" />
      <div className="absolute top-0 right-0 size-1.5 bg-foreground dark:bg-ring pointer-events-none z-10" />
      <div className="absolute bottom-0 left-0 size-1.5 bg-foreground dark:bg-ring pointer-events-none z-10" />
      <div className="absolute bottom-0 right-0 size-1.5 bg-foreground dark:bg-ring pointer-events-none z-10" />

      <ShadcnButtonGroup
        className={cn(
          // The group draws one shared border, so the per-button pixel borders
          // would double it up on the outer edges and paint across every
          // junction.
          "[&_[data-slot=button-decorations]]:hidden",
          className
        )}
        orientation={orientation}
        {...props}
      >
        {children}
      </ShadcnButtonGroup>
    </div>
  );
}

// ─── ButtonGroupSeparator ────────────────────────────────────────────────────

export type BitButtonGroupSeparatorProps = React.ComponentProps<"div"> & {
  orientation?: "horizontal" | "vertical";
};

/**
 * 8-bit ButtonGroupSeparator renders a solid pixel divider between items.
 * Defaults to `orientation="vertical"` for use inside a horizontal ButtonGroup.
 *
 * This deliberately does not reuse the 8-bit Separator: that one paints a
 * dashed pattern whose transparent segments would expose the page background
 * through the group, reading as gaps between the buttons. It is also sized to
 * the same 6px grid as the group's border rather than the Separator's 2px.
 */
function ButtonGroupSeparator({
  className,
  orientation = "vertical",
  ...props
}: BitButtonGroupSeparatorProps) {
  return (
    <div
      aria-orientation={orientation}
      className={cn(
        "shrink-0 self-stretch bg-foreground dark:bg-ring",
        orientation === "vertical" ? "w-1.5" : "h-1.5",
        className
      )}
      data-orientation={orientation}
      data-slot="button-group-separator"
      role="separator"
      {...props}
    />
  );
}

// ─── ButtonGroupText ─────────────────────────────────────────────────────────

export type BitButtonGroupTextProps = React.ComponentProps<
  typeof ShadcnButtonGroupText
>;

/**
 * 8-bit ButtonGroupText renders a retro-styled text label inside a ButtonGroup.
 * Useful for split-button patterns (e.g. a label prefix before action buttons).
 */
function ButtonGroupText({ className, ...props }: BitButtonGroupTextProps) {
  return (
    <ShadcnButtonGroupText
      className={cn("rounded-none border-none retro", className)}
      {...props}
    />
  );
}

export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText };

More like this

Blur Text

React Bits·Text effectsMIT+

Text Type

React Bits·Text effectsMIT+

Tilt

Motion Primitives·Cards

Split Text

React Bits·Text effectsMIT+

Carousel

Motion Primitives·Media & 3D

Cursor

Motion Primitives·Cursor & effects

Image Comparison

Motion Primitives·Media & 3D

In View

Motion Primitives·Cursor & effects

Morphing Popover

Motion Primitives·Text effects

Magnet

React Bits·Cursor & effectsMIT+

8-bit Badge

8bitcn·Data display

Text Morph

Motion Primitives·Text effects

Text Roll

Motion Primitives·Text effects

Flip Button

Animate UI·ButtonsMIT+

Dock

Motion Primitives·Navigation