BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/solid-ui/bar-list

Bar List

solid-ui/bar-list
FreeComponent

A bar list component

Live preview

live · rendered by the registry
Rendered by solid-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://www.solid-ui.com/r/bar-list.json

Source

src/registry/ui/bar-list.tsxwww.solid-ui.com/r/bar-list.json
1import type { ComponentProps, JSX } from "solid-js"
2import { For, mergeProps, Show, splitProps } from "solid-js"
3import { Dynamic } from "solid-js/web"
4
5import { cn } from "~/lib/utils"
6
7type Bar<T> = T & {
8 value: number
9 name: JSX.Element
10 icon?: (props: ComponentProps<"svg">) => JSX.Element
11 href?: string
12 target?: string
13}
14
15type SortOrder = "ascending" | "descending" | "none"
16
17type ValueFormatter = (value: number) => string
18
19const defaultValueFormatter: ValueFormatter = (value: number) => value.toString()
20
21type BarListProps<T> = ComponentProps<"div"> & {
22 data: Bar<T>[]
23 valueFormatter?: ValueFormatter
24 sortOrder?: SortOrder
25}
26
27const BarList = <T,>(rawProps: BarListProps<T>) => {
28 const props = mergeProps(
29 {
30 valueFormatter: defaultValueFormatter,
31 sortOrder: "descending" as SortOrder
32 },
33 rawProps
34 )
35 const [local, others] = splitProps(props, ["class", "data", "valueFormatter", "sortOrder"])
36
37 const sortedData = () => {
38 if (local.sortOrder === "none") {
39 return local.data
40 }
41 return local.data.sort((a, b) =>
42 local.sortOrder === "ascending" ? a.value - b.value : b.value - a.value
43 )
44 }
45
46 const widths = () => {
47 const maxValue = Math.max(...sortedData().map((item) => item.value), 0)
48 return sortedData().map((item) =>
49 item.value === 0 ? 0 : Math.max((item.value / maxValue) * 100, 2)
50 )
51 }
52
53 return (
54 <div
55 class={cn("flex flex-col space-y-1.5", local.class)}
56 aria-sort={local.sortOrder}
57 {...others}
58 >
59 <For each={sortedData()}>
60 {(bar, idx) => {
61 return (
62 <div class="row flex w-full justify-between space-x-6">
63 <div class="grow">
64 <div
65 class={cn("flex h-8 items-center rounded-md bg-secondary px-2")}
66 style={{
67 width: `${widths()[idx()]}%`
68 }}
69 >
70 <Show when={bar.icon}>
71 {(icon) => <Dynamic component={icon()} class="mr-2 size-5 flex-none" />}
72 </Show>
73 <Show when={bar.href} fallback={<p>{bar.name}</p>}>
74 {(href) => (
75 <a
76 href={href()}
77 target={bar.target ?? "_blank"}
78 rel="noreferrer"
79 class="hover:underline"
80 >
81 {bar.name}
82 </a>
83 )}
84// … truncated

What it pulls in

npm packages

  • solid-js

Files it writes

  • src/registry/ui/bar-list.tsx

Facts

Registry
solid-ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
yesterday

Go to the source

Docs on solid-ui www.solid-ui.com stefan-karger/solid-ui on GitHub Raw registry item This item as JSON

More from solid-ui

All 55 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordionsolid-uiComponentsFree2 deps
Alertalertsolid-uiComponentsFree3 deps
Alert Dialogalert-dialogsolid-uiComponentsFree2 deps
Aspect Ratioaspect-ratiosolid-uiComponentsFree1 dep
Avataravatarsolid-uiComponentsFree2 deps
Badgebadgesolid-uiComponentsFree2 deps
Badge Deltabadge-deltasolid-uiComponentsFree2 deps
Breadcrumbbreadcrumbsolid-uiComponentsFree2 deps
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