progress
shadcn-solidjs/progressFreeComponent
shadcn-solidjs publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by shadcn-solidjs on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://shadcn-solidjs.com/r/progress.jsonSource
1import type { PolymorphicProps } from "@kobalte/core/polymorphic";2import * as ProgressPrimitive from "@kobalte/core/progress";34import { cn } from "~/lib/utils.ts";5import type { JSX, ValidComponent } from "solid-js";67import { splitProps } from "solid-js";89type ProgressRootProps<T extends ValidComponent = "div"> =10 & ProgressPrimitive.ProgressRootProps<T>11 & { class?: string | undefined; children?: JSX.Element };1213const Progress = <T extends ValidComponent = "div">(14 props: PolymorphicProps<T, ProgressRootProps<T>>,15) => {16 const [local, others] = splitProps(props as ProgressRootProps, [17 "class",18 "children",19 ]);20 return (21 <ProgressPrimitive.Root22 data-slot="progress"23 class={cn("flex flex-wrap gap-3", local.class)}24 {...others}25 >26 {local.children}27 <ProgressTrack>28 <ProgressIndicator />29 </ProgressTrack>30 </ProgressPrimitive.Root>31 );32};3334type ProgressTrackProps<T extends ValidComponent = "div"> =35 & ProgressPrimitive.ProgressTrackProps<T>36 & { class?: string | undefined; children?: JSX.Element };3738const ProgressTrack = <T extends ValidComponent = "div">(39 props: PolymorphicProps<T, ProgressTrackProps<T>>,40) => {41 const [local, others] = splitProps(props as ProgressTrackProps, ["class"]);42 return (43 <ProgressPrimitive.Track44 data-slot="progress-track"45 class={cn(46 "bg-muted h-1 rounded-full relative flex w-full items-center overflow-x-hidden",47 local.class,48 )}49 {...others}50 />51 );52};5354type ProgressIndicatorProps<T extends ValidComponent = "div"> =55 & ProgressPrimitive.ProgressFillProps<T>56 & { class?: string | undefined };5758const ProgressIndicator = <T extends ValidComponent = "div">(59 props: PolymorphicProps<T, ProgressIndicatorProps<T>>,60) => {61 const [local, others] = splitProps(props as ProgressIndicatorProps, [62 "class",63 "style",64 ]);65 // the fill rides on transform, so a consumer style has to merge with it66 // rather than replace it67 const transform =68 "translateX(calc(var(--kb-progress-fill-width, 0%) - 100%))";69 return (70 <ProgressPrimitive.Fill71 data-slot="progress-indicator"72 class={cn(73 "bg-primary size-full flex-1 transition-all",74 local.class,75 )}76 style={typeof local.style === "string"77 ? `transform:${transform};${local.style}`78 : { transform, ...local.style }}79 {...others}80 />81 );82};8384type ProgressLabelProps<T extends ValidComponent = "span"> =85// … truncated
What it pulls in
npm packages
More from shadcn-solidjs
All 85 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | shadcn-solidjs | Components | Free | 1 dep | |
| alertalert | shadcn-solidjs | Components | Free | 2 deps | |
| alert-dialogalert-dialog | shadcn-solidjs | Components | Free | 2 deps | |
| aspect-ratioaspect-ratio | shadcn-solidjs | Components | Free | no deps | |
| attachmentattachment | shadcn-solidjs | Components | Free | 2 deps | |
| avataravatar | shadcn-solidjs | Components | Free | 1 dep | |
| badgebadge | shadcn-solidjs | Components | Free | 2 deps | |
| breadcrumbbreadcrumb | shadcn-solidjs | Components | Free | 1 dep |
