diff --git a/app/docs/components/toggle-group/page.tsx b/app/docs/components/toggle-group/page.tsx
new file mode 100644
index 00000000..2d152e41
--- /dev/null
+++ b/app/docs/components/toggle-group/page.tsx
@@ -0,0 +1,229 @@
+import { Metadata } from "next"
+import { Separator } from "@radix-ui/react-select"
+import { Bold, Italic, Underline } from "lucide-react"
+
+import { toggleGroupMetaData } from "@/lib/metadata"
+import { ToggleGroup, ToggleGroupItem } from "@/components/ui/8bit/toggle-group"
+
+import CodeSnippet from "../code-snippet"
+import CopyCommandButton from "../copy-command-button"
+import InstallationCommands from "../installation-commands"
+import { OpenInV0Button } from "../open-in-v0-button"
+
+export const metadata: Metadata = {
+ title: "8bit Toggle Group",
+ description: "Displays Toggle Group Component.",
+ openGraph: { images: toggleGroupMetaData },
+}
+export default function ToggleGroupPage() {
+ return (
+
+
+
Toggle Group
+
+
+
+ A set of two-state buttons that can be toggled on or off.
+
+
+
+
+ A simple 8-bit Toggle Group component
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Installation
+
+
Examples
+
Default
+
+
+
+ Default example
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{`
+
+
+
+
+
+
+
+
+
+`}
+
Outline
+
+
+
+ Outline example
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{`
+
+
+
+
+
+
+
+
+
+`}
+
Single
+
+
+
+ Single example
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{`
+
+
+
+
+
+
+
+
+
+`}
+
Disabled
+
+
+
+ Disabled example
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{`
+
+
+
+
+
+
+
+
+
+`}
+
+
+ )
+}
diff --git a/components/ui/8bit/toggle-group.tsx b/components/ui/8bit/toggle-group.tsx
new file mode 100644
index 00000000..0dc03a3e
--- /dev/null
+++ b/components/ui/8bit/toggle-group.tsx
@@ -0,0 +1,88 @@
+import { Press_Start_2P } from "next/font/google"
+import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
+import { cva, type VariantProps } from "class-variance-authority"
+
+import { cn } from "@/lib/utils"
+
+import {
+ ToggleGroup as ShadcnToggleGroup,
+ ToggleGroupItem as ShadcnToggleGroupItem,
+} from "../toggle-group"
+
+const pressStart = Press_Start_2P({ weight: ["400"], subsets: ["latin"] })
+
+export const toggleGroupVariants = cva("", {
+ variants: {
+ font: { normal: "", retro: pressStart.className },
+ variant: {
+ default: "bg-transparent",
+ outline:
+ "bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground",
+ },
+ size: {
+ default: "h-9 px-2 min-w-9",
+ sm: "h-4 px-1.5 min-w-4",
+ lg: "h-10 px-2.5 min-w-10",
+ },
+ },
+ defaultVariants: { variant: "default", font: "retro", size: "default" },
+})
+
+export type BitToggleGroupProps = React.ComponentPropsWithoutRef<
+ typeof ToggleGroupPrimitive.Root
+> &
+ VariantProps
+
+export type BitToggleGroupItemProps = React.ComponentPropsWithoutRef<
+ typeof ToggleGroupPrimitive.Item
+> &
+ VariantProps
+
+function ToggleGroup({ ...props }: BitToggleGroupProps) {
+ const { className, font, children } = props
+
+ return (
+
+ {" "}
+ {children}{" "}
+
+ )
+}
+function ToggleGroupItem({ ...props }: BitToggleGroupItemProps) {
+ const { className, font, children, variant } = props
+ return (
+
+ {" "}
+ {children}{" "}
+ {variant === "outline" && (
+ <>
+ {" "}
+ {" "}
+ {" "}
+ >
+ )}{" "}
+
+ )
+}
+
+export { ToggleGroup, ToggleGroupItem }
diff --git a/components/ui/toggle-group.tsx b/components/ui/toggle-group.tsx
new file mode 100644
index 00000000..1c876bbe
--- /dev/null
+++ b/components/ui/toggle-group.tsx
@@ -0,0 +1,61 @@
+"use client"
+
+import * as React from "react"
+import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
+import { type VariantProps } from "class-variance-authority"
+
+import { cn } from "@/lib/utils"
+import { toggleVariants } from "@/components/ui/toggle"
+
+const ToggleGroupContext = React.createContext<
+ VariantProps
+>({
+ size: "default",
+ variant: "default",
+})
+
+const ToggleGroup = React.forwardRef<
+ React.ElementRef,
+ React.ComponentPropsWithoutRef &
+ VariantProps
+>(({ className, variant, size, children, ...props }, ref) => (
+
+
+ {children}
+
+
+))
+
+ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName
+
+const ToggleGroupItem = React.forwardRef<
+ React.ElementRef,
+ React.ComponentPropsWithoutRef &
+ VariantProps
+>(({ className, children, variant, size, ...props }, ref) => {
+ const context = React.useContext(ToggleGroupContext)
+
+ return (
+
+ {children}
+
+ )
+})
+
+ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName
+
+export { ToggleGroup, ToggleGroupItem }
diff --git a/config/nav-items.ts b/config/nav-items.ts
index 9131d7c8..a495ea7d 100644
--- a/config/nav-items.ts
+++ b/config/nav-items.ts
@@ -166,6 +166,11 @@ export const navItems = {
title: "Toggle",
url: "/docs/components/toggle",
},
+ {
+ title: "Toggle Group",
+ url: "/docs/components/toggle-group",
+ new: true,
+ },
{
title: "Tooltip",
url: "/docs/components/tooltip",
diff --git a/lib/metadata.ts b/lib/metadata.ts
index bb9e9526..2da28af9 100644
--- a/lib/metadata.ts
+++ b/lib/metadata.ts
@@ -45,3 +45,4 @@ export const resizableMetaData = "/assets/8bitcn-resizable-light.png"
export const paginationMetaData = "/assets/8bitcn-pagination-light.png"
export const scrollAreaMetaData = "/assets/8bitcn-scrollarea-light.png"
export const chartMetaData = "/assets/8bitcn-chart-light.png"
+export const toggleGroupMetaData = "/assets/8bitcn-toggle-group-light.png"
diff --git a/package.json b/package.json
index c6313241..4be9a7c7 100644
--- a/package.json
+++ b/package.json
@@ -29,6 +29,7 @@
"@radix-ui/react-switch": "^1.2.4",
"@radix-ui/react-tabs": "^1.1.11",
"@radix-ui/react-toggle": "^1.1.8",
+ "@radix-ui/react-toggle-group": "^1.1.9",
"@radix-ui/react-tooltip": "^1.2.6",
"@vercel/analytics": "^1.5.0",
"class-variance-authority": "^0.7.1",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 73e4905c..576f7d43 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -62,6 +62,9 @@ importers:
'@radix-ui/react-toggle':
specifier: ^1.1.8
version: 1.1.8(@types/react-dom@19.1.3(@types/react@19.1.3))(@types/react@19.1.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
+ '@radix-ui/react-toggle-group':
+ specifier: ^1.1.9
+ version: 1.1.9(@types/react-dom@19.1.3(@types/react@19.1.3))(@types/react@19.1.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
'@radix-ui/react-tooltip':
specifier: ^1.2.6
version: 1.2.6(@types/react-dom@19.1.3(@types/react@19.1.3))(@types/react@19.1.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
@@ -1046,6 +1049,19 @@ packages:
'@types/react-dom':
optional: true
+ '@radix-ui/react-toggle-group@1.1.9':
+ resolution: {integrity: sha512-HJ6gXdYVN38q/5KDdCcd+JTuXUyFZBMJbwXaU/82/Gi+V2ps6KpiZ2sQecAeZCV80POGRfkUBdUIj6hIdF6/MQ==}
+ peerDependencies:
+ '@types/react': '*'
+ '@types/react-dom': '*'
+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ '@types/react-dom':
+ optional: true
+
'@radix-ui/react-toggle@1.1.8':
resolution: {integrity: sha512-hrpa59m3zDnsa35LrTOH5s/a3iGv/VD+KKQjjiCTo/W4r0XwPpiWQvAv6Xl1nupSoaZeNNxW6sJH9ZydsjKdYQ==}
peerDependencies:
@@ -4638,6 +4654,21 @@ snapshots:
'@types/react': 19.1.3
'@types/react-dom': 19.1.3(@types/react@19.1.3)
+ '@radix-ui/react-toggle-group@1.1.9(@types/react-dom@19.1.3(@types/react@19.1.3))(@types/react@19.1.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)':
+ dependencies:
+ '@radix-ui/primitive': 1.1.2
+ '@radix-ui/react-context': 1.1.2(@types/react@19.1.3)(react@19.1.0)
+ '@radix-ui/react-direction': 1.1.1(@types/react@19.1.3)(react@19.1.0)
+ '@radix-ui/react-primitive': 2.1.2(@types/react-dom@19.1.3(@types/react@19.1.3))(@types/react@19.1.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
+ '@radix-ui/react-roving-focus': 1.1.9(@types/react-dom@19.1.3(@types/react@19.1.3))(@types/react@19.1.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
+ '@radix-ui/react-toggle': 1.1.8(@types/react-dom@19.1.3(@types/react@19.1.3))(@types/react@19.1.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/react@19.1.3)(react@19.1.0)
+ react: 19.1.0
+ react-dom: 19.1.0(react@19.1.0)
+ optionalDependencies:
+ '@types/react': 19.1.3
+ '@types/react-dom': 19.1.3(@types/react@19.1.3)
+
'@radix-ui/react-toggle@1.1.8(@types/react-dom@19.1.3(@types/react@19.1.3))(@types/react@19.1.3)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)':
dependencies:
'@radix-ui/primitive': 1.1.2
diff --git a/public/assets/8bitcn-toggle-group-light.png b/public/assets/8bitcn-toggle-group-light.png
new file mode 100644
index 00000000..170183fe
Binary files /dev/null and b/public/assets/8bitcn-toggle-group-light.png differ
diff --git a/public/r/8bit-toggle-group.json b/public/r/8bit-toggle-group.json
new file mode 100644
index 00000000..5971c926
--- /dev/null
+++ b/public/r/8bit-toggle-group.json
@@ -0,0 +1,18 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "8bit-toggle-group",
+ "type": "registry:component",
+ "title": "8-bit Toggle Group",
+ "description": "A simple 8-bit toggle group component",
+ "registryDependencies": [
+ "toggle-group"
+ ],
+ "files": [
+ {
+ "path": "components/ui/8bit/toggle-group.tsx",
+ "content": "import { Press_Start_2P } from \"next/font/google\"\nimport * as ToggleGroupPrimitive from \"@radix-ui/react-toggle-group\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport {\n ToggleGroup as ShadcnToggleGroup,\n ToggleGroupItem as ShadcnToggleGroupItem,\n} from \"../toggle-group\"\n\nconst pressStart = Press_Start_2P({ weight: [\"400\"], subsets: [\"latin\"] })\n\nexport const toggleGroupVariants = cva(\"\", {\n variants: {\n font: { normal: \"\", retro: pressStart.className },\n variant: {\n default: \"bg-transparent\",\n outline:\n \"bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground\",\n },\n size: {\n default: \"h-9 px-2 min-w-9\",\n sm: \"h-4 px-1.5 min-w-4\",\n lg: \"h-10 px-2.5 min-w-10\",\n },\n },\n defaultVariants: { variant: \"default\", font: \"retro\", size: \"default\" },\n})\n\nexport type BitToggleGroupProps = React.ComponentPropsWithoutRef<\n typeof ToggleGroupPrimitive.Root\n> &\n VariantProps\n\nexport type BitToggleGroupItemProps = React.ComponentPropsWithoutRef<\n typeof ToggleGroupPrimitive.Item\n> &\n VariantProps\n\nfunction ToggleGroup({ ...props }: BitToggleGroupProps) {\n const { className, font, children } = props\n\n return (\n \n {\" \"}\n {children}{\" \"}\n \n )\n}\nfunction ToggleGroupItem({ ...props }: BitToggleGroupItemProps) {\n const { className, font, children, variant } = props\n return (\n \n {\" \"}\n {children}{\" \"}\n {variant === \"outline\" && (\n <>\n {\" \"}\n {\" \"}\n {\" \"}\n >\n )}{\" \"}\n \n )\n}\n\nexport { ToggleGroup, ToggleGroupItem }\n",
+ "type": "registry:component",
+ "target": "components/ui/8bit/toggle-group.tsx"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/registry.json b/registry.json
index 20862441..18dbe3fa 100644
--- a/registry.json
+++ b/registry.json
@@ -657,6 +657,20 @@
"target": "components/ui/8bit/chart.tsx"
}
]
+ },
+ {
+ "name": "8bit-toggle-group",
+ "type": "registry:component",
+ "title": "8-bit Toggle Group",
+ "description": "A simple 8-bit toggle group component",
+ "registryDependencies": ["toggle-group"],
+ "files": [
+ {
+ "path": "components/ui/8bit/toggle-group.tsx",
+ "type": "registry:component",
+ "target": "components/ui/8bit/toggle-group.tsx"
+ }
+ ]
}
]
}