BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/8bitcn/friend-list

8-bit Friend List

8bitcn/friend-list
FreeBlock

A simple 8-bit friend list component

Install it

npx shadcn@latest add https://www.8bitcn.com/r/friend-list.json

Source

components/ui/8bit/blocks/friend-list.tsxwww.8bitcn.com/r/friend-list.json
1import { cn } from "@/lib/utils";
2import {
3 Card,
4 CardContent,
5 CardHeader,
6 CardTitle,
7} from "@/components/ui/8bit/card";
8import {
9 Avatar,
10 AvatarFallback,
11 AvatarImage,
12} from "@/components/ui/8bit/avatar";
13import { cva } from "class-variance-authority";
14import { ScrollArea } from "@/components/ui/8bit/scroll-area";
15
16const truncate = (
17 str: string | null | undefined,
18 length: number
19): string | null => {
20 if (!str || str.length <= length) return str ?? null;
21 return `${str.slice(0, length - 3)}...`;
22};
23
24const statusVariants = cva("w-2 h-2 flex-shrink-0", {
25 variants: {
26 status: {
27 ingame: "bg-destructive border-destructive",
28 online: "bg-primary border-primary",
29 away: "bg-accent border-accent",
30 offline: "bg-muted border-muted",
31 default: "bg-muted border-muted",
32 },
33 },
34 defaultVariants: {
35 status: "default",
36 },
37});
38
39const playerCardVariants = cva(
40 "flex items-center justify-between sm:p-3 p-2 rounded-lg transition-all duration-200 min-w-[150px] overflow-hidden",
41 {
42 variants: {
43 status: {
44 default: "bg-muted/50 hover:bg-muted",
45 },
46 },
47 }
48);
49
50export interface FriendListPlayer {
51 id: number;
52 name: string;
53 status: "online" | "ingame" | "away" | "offline";
54 avatar?: string;
55 avatarFallback?: string;
56 activity?: string;
57}
58export interface FriendListProps extends React.ComponentPropsWithoutRef<"div"> {
59 players: FriendListPlayer[];
60 className?: string;
61 showstatus?: boolean;
62 showactivity?: boolean;
63}
64export default function FriendList({
65 className,
66 showstatus = true,
67 showactivity = true,
68 players,
69 ...props
70}: FriendListProps){
71 return (
72 <div
73 className={cn("flex flex-col gap-6 w-full h-full", className)}
74 {...props}
75 >
76 <Card data-slot="friend-list" font={"retro"}>
77 <CardHeader>
78 <CardTitle className="text-xl sm:text-2xl text-center gap-2">
79 Friends (
80 {
81 players.filter(
82 (player) =>
83 player.status === "online" || player.status === "ingame"
84 ).length
85 }
86 /{players.length})
87 </CardTitle>
88 </CardHeader>
89 <CardContent className="space-y-5 px-1 min-w-[150px]">
90 <ScrollArea className="h-[400px]">
91 <div className="space-y-2 mx-8">
92 {players.map((player) => (
93 <div
94 key={player.id}
95// … truncated

What it pulls in

Other registry items

  • avatar
  • card
  • scroll-area

Files it writes

  • components/ui/8bit/blocks/friend-list.tsx
  • components/ui/8bit/scroll-area.tsx
  • components/ui/8bit/card.tsx
  • components/ui/8bit/avatar.tsx
  • components/ui/8bit/styles/retro.css

Facts

Registry
8bitcn
Type
registry:block
Access
Free
Files written
5
Licence
the repository states none
First indexed
2026-08-04
Last confirmed
today

Go to the source

www.8bitcn.com Raw registry item This item as JSON

More from 8bitcn

All 121 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
8-bit Advanced 1advanced18bitcnBlocksFreeno deps · 3 files
8-bit Advanced 2advanced28bitcnBlocksFreeno deps · 5 files
8-bit Advanced 3advanced38bitcnBlocksFreeno deps · 6 files
8-bit Audio Settingsaudio-settings8bitcnBlocksFree2 deps · 7 files
8-bit Chapter Introchapter-intro8bitcnBlocksFreeno deps · 3 files
8-bit Character Sheetcharacter-sheet8bitcnBlocksFreeno deps · 9 files
8-bit Chartchart8bitcnBlocksFreeno deps · 3 files
8-bit Chart Area Stepchart-area-step8bitcnBlocksFreeno deps · 3 files
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex