8bitcn UI
blockaudio-settingssource: ok · hit
8-bit Audio Settings
A simple 8-bit audio settings component
npx shadcn add "https://www.8bitcn.com/r/audio-settings.json"free
Where it goes
settings-form
Use cases
dashboard
Tags auto-generated by rules on 9/24/2026 — empty means no evidence, not lack of support.
Dependencies
Bundle weight · lightui-primitives@radix-ui/react-slider@radix-ui/react-switch
Registry dependencies
buttoncardlabelsliderswitch
Files7 · source cached 10/8/2026, 1:43:33 PM
components/ui/8bit/blocks/audio-settings.tsx
import { cn } from "@/lib/utils";
import {
Card,
CardContent,
CardHeader,
CardTitle,
} from "@/components/ui/8bit/card";
import { Label } from "@/components/ui/8bit/label";
import { Slider } from "@/components/ui/8bit/slider";
import { Switch } from "@/components/ui/8bit/switch";
export default function AudioSettings({
className,
...props
}: React.ComponentProps<"div">) {
return (
<div className={cn("flex flex-col gap-6", className)} {...props}>
<Card>
<CardHeader>
<CardTitle className="text-sm font-medium">Audio Settings</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="space-y-4">
<Label htmlFor="volume">Master Volume</Label>
<Slider
id="volume"
defaultValue={[75]}
max={100}
step={1}
className="w-full"
/>
</div>
<div className="space-y-4">
<Label htmlFor="sfx">SFX Volume</Label>
<Slider
id="sfx"
defaultValue={[60]}
max={100}
step={1}
className="w-full"
/>
</div>
<div className="flex items-center justify-between">
<Label htmlFor="mute">Mute Audio</Label>
<Switch id="mute" />
</div>
<div className="flex items-center justify-between">
<Label htmlFor="vibration">Vibration</Label>
<Switch id="vibration" defaultChecked />
</div>
</CardContent>
</Card>
</div>
);
}
components/ui/8bit/styles/retro.css
@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap");
.retro {
font-family:
"Press Start 2P",
system-ui,
-apple-system,
sans-serif;
line-height: 1.5;
letter-spacing: 0.5px;
}
.pixelated {
image-rendering: pixelated;
image-rendering: crisp-edges;
}components/ui/8bit/switch.tsx
"use client";
import type * as React from "react";
import * as SwitchPrimitive from "@radix-ui/react-switch";
import { cn } from "@/lib/utils";
function Switch({
className,
...props
}: React.ComponentProps<typeof SwitchPrimitive.Root>) {
return (
<SwitchPrimitive.Root
data-slot="switch"
className={cn(
"relative peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-4 w-8 shrink-0 items-center border border-transparent shadow-xs transition-all outline-none border-none disabled:cursor-not-allowed disabled:opacity-50",
className
)}
{...props}
>
<SwitchPrimitive.Thumb
data-slot="switch-thumb"
className={cn(
"bg-primary data-[state=checked]:bg-primary-foreground dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground pointer-events-none block size-4 data-[state=checked]:border-l data-[state=unchecked]:border-r border-foreground dark:border-ring ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%)] data-[state=unchecked]:translate-x-0"
)}
/>
<div
className="absolute inset-0 border-y-4 -my-1 border-foreground dark:border-ring pointer-events-none"
aria-hidden="true"
/>
<div
className="absolute inset-0 border-x-4 -mx-1 border-foreground dark:border-ring pointer-events-none"
aria-hidden="true"
/>
</SwitchPrimitive.Root>
);
}
export { Switch };
components/ui/8bit/card.tsx
import { type VariantProps, cva } from "class-variance-authority";
import { cn } from "@/lib/utils";
import {
Card as ShadcnCard,
CardAction as ShadcnCardAction,
CardContent as ShadcnCardContent,
CardDescription as ShadcnCardDescription,
CardFooter as ShadcnCardFooter,
CardHeader as ShadcnCardHeader,
CardTitle as ShadcnCardTitle,
} from "@/components/ui/card";
import "@/components/ui/8bit/styles/retro.css";
export const cardVariants = cva("", {
variants: {
font: {
normal: "",
retro: "retro",
},
},
defaultVariants: {
font: "retro",
},
});
export interface BitCardProps
extends React.ComponentProps<"div">,
VariantProps<typeof cardVariants> {
asChild?: boolean;
}
function Card({ className, font, ...props }: BitCardProps) {
return (
<div
className={cn(
"relative bg-card text-card-foreground border-y-6 border-foreground dark:border-ring p-0!",
className
)}
>
<ShadcnCard
{...props}
className={cn(
"rounded-none border-0 w-full! h-full flex flex-col bg-card text-card-foreground shadow-none",
font !== "normal" && "retro",
className
)}
/>
<div
className={cn("absolute inset-0 border-x-6 -mx-1.5 border-inherit pointer-events-none")}
aria-hidden="true"
/>
</div>
);
}
function CardHeader({ ...props }: BitCardProps) {
const { className, font } = props;
return (
<ShadcnCardHeader
className={cn(font !== "normal" && "retro", className)}
{...props}
/>
);
}
function CardTitle({ ...props }: BitCardProps) {
const { className, font } = props;
return (
<ShadcnCardTitle
className={cn(font !== "normal" && "retro", className)}
{...props}
/>
);
}
function CardDescription({ ...props }: BitCardProps) {
const { className, font } = props;
return (
<ShadcnCardDescription
className={cn(font !== "normal" && "retro", className)}
{...props}
/>
);
}
function CardAction({ ...props }: BitCardProps) {
const { className, font } = props;
return (
<ShadcnCardAction
className={cn(font !== "normal" && "retro", className)}
{...props}
/>
);
}
function CardContent({ ...props }: BitCardProps) {
const { className, font } = props;
return (
<ShadcnCardContent
className={cn("flex-1", font !== "normal" && "retro", className)}
{...props}
/>
);
}
function CardFooter({ ...props }: BitCardProps) {
const { className, font } = props;
return (
<ShadcnCardFooter
data-slot="card-footer"
className={cn(font !== "normal" && "retro", className)}
{...props}
/>
);
}
export {
Card,
CardHeader,
CardFooter,
CardTitle,
CardAction,
CardDescription,
CardContent,
};
components/ui/8bit/slider.tsx
"use client";
import * as React from "react";
import * as SliderPrimitive from "@radix-ui/react-slider";
import { cn } from "@/lib/utils";
const Slider = React.forwardRef<
React.ComponentRef<typeof SliderPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
>(({ className, ...props }, ref) => (
<div className={cn("relative w-full", className)}>
<SliderPrimitive.Root
ref={ref}
className={cn(
"relative flex w-full touch-none select-none items-center",
className
)}
{...props}
>
<SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden bg-secondary">
<SliderPrimitive.Range className="absolute h-full bg-primary" />
</SliderPrimitive.Track>
<SliderPrimitive.Thumb className="block size-5 border-2 border-foreground dark:border-ring bg-foreground dark:bg-ring ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0 disabled:pointer-events-none disabled:opacity-50" />
</SliderPrimitive.Root>
<div
className="absolute inset-0 border-y-4 -my-1 border-foreground dark:border-ring pointer-events-none"
aria-hidden="true"
/>
<div
className="absolute inset-0 border-x-4 -mx-1 border-foreground dark:border-ring pointer-events-none"
aria-hidden="true"
/>
</div>
));
Slider.displayName = SliderPrimitive.Root.displayName;
export { Slider };
components/ui/8bit/label.tsx
"use client";
import type * as React from "react";
import type * as LabelPrimitive from "@radix-ui/react-label";
import { type VariantProps, cva } from "class-variance-authority";
import { cn } from "@/lib/utils";
import { Label as ShadcnLabel } from "@/components/ui/label";
import "@/components/ui/8bit/styles/retro.css";
export const inputVariants = cva("", {
variants: {
font: {
normal: "",
retro: "retro",
},
},
defaultVariants: {
font: "retro",
},
});
interface BitLabelProps
extends React.ComponentProps<typeof LabelPrimitive.Root>,
VariantProps<typeof inputVariants> {
asChild?: boolean;
}
function Label({ className, font, ...props }: BitLabelProps) {
return (
<ShadcnLabel
className={cn(className, font !== "normal" && "retro")}
{...props}
/>
);
}
export { Label };
components/ui/8bit/button.tsx
import { type VariantProps, cva } from "class-variance-authority";
import { Slot } from "radix-ui";
import type { ButtonHTMLAttributes, Ref } from "react";
import { Button as ShadcnButton } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import "@/components/ui/8bit/styles/retro.css";
export const buttonVariants = cva("", {
variants: {
font: {
normal: "",
retro: "retro",
},
variant: {
default: "bg-foreground",
destructive: "bg-foreground",
outline: "bg-foreground",
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "",
sm: "",
lg: "",
icon: "",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
});
export interface BitButtonProps
extends ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean;
ref?: Ref<HTMLButtonElement>;
}
interface ButtonDecorationsProps {
size: BitButtonProps["size"];
variant: BitButtonProps["variant"];
}
function ButtonDecorations({ size, variant }: ButtonDecorationsProps) {
return (
<span
aria-hidden="true"
className="pointer-events-none contents"
data-slot="button-decorations"
>
{variant !== "ghost" && variant !== "link" && size !== "icon" && (
<>
{/* Pixelated border */}
<span className="absolute -top-1.5 left-1.5 h-1.5 w-1/2 bg-foreground dark:bg-ring" />
<span className="absolute -top-1.5 right-1.5 h-1.5 w-1/2 bg-foreground dark:bg-ring" />
<span className="absolute -bottom-1.5 left-1.5 h-1.5 w-1/2 bg-foreground dark:bg-ring" />
<span className="absolute -bottom-1.5 right-1.5 h-1.5 w-1/2 bg-foreground dark:bg-ring" />
<span className="absolute top-0 left-0 size-1.5 bg-foreground dark:bg-ring" />
<span className="absolute top-0 right-0 size-1.5 bg-foreground dark:bg-ring" />
<span className="absolute bottom-0 left-0 size-1.5 bg-foreground dark:bg-ring" />
<span className="absolute right-0 bottom-0 size-1.5 bg-foreground dark:bg-ring" />
<span className="absolute top-1.5 -left-1.5 h-[calc(100%-12px)] w-1.5 bg-foreground dark:bg-ring" />
<span className="absolute top-1.5 -right-1.5 h-[calc(100%-12px)] w-1.5 bg-foreground dark:bg-ring" />
{variant !== "outline" && (
<>
{/* Top shadow */}
<span className="absolute top-0 left-0 h-1.5 w-full bg-foreground/20" />
<span className="absolute top-1.5 left-0 h-1.5 w-3 bg-foreground/20" />
{/* Bottom shadow */}
<span className="absolute bottom-0 left-0 h-1.5 w-full bg-foreground/20" />
<span className="absolute right-0 bottom-1.5 h-1.5 w-3 bg-foreground/20" />
</>
)}
</>
)}
{size === "icon" && (
<>
<span className="absolute top-0 left-0 h-[5px] w-full bg-foreground md:h-1.5 dark:bg-ring" />
<span className="absolute bottom-0 h-[5px] w-full bg-foreground md:h-1.5 dark:bg-ring" />
<span className="absolute top-1 -left-1 h-1/2 w-[5px] bg-foreground md:w-1.5 dark:bg-ring" />
<span className="absolute bottom-1 -left-1 h-1/2 w-[5px] bg-foreground md:w-1.5 dark:bg-ring" />
<span className="absolute top-1 -right-1 h-1/2 w-[5px] bg-foreground md:w-1.5 dark:bg-ring" />
<span className="absolute -right-1 bottom-1 h-1/2 w-[5px] bg-foreground md:w-1.5 dark:bg-ring" />
</>
)}
</span>
);
}
function Button({
asChild = false,
children,
className,
font,
size,
variant,
...props
}: BitButtonProps) {
const decorations = <ButtonDecorations size={size} variant={variant} />;
return (
<ShadcnButton
{...props}
className={cn(
"rounded-none active:translate-y-1 transition-transform relative inline-flex items-center justify-center gap-1.5 border-none",
size === "icon" && "mx-1 my-0",
font !== "normal" && "retro",
className
)}
size={size}
variant={variant}
asChild={asChild}
>
{asChild ? <Slot.Slottable>{children}</Slot.Slottable> : children}
{decorations}
</ShadcnButton>
);
}
export { Button };