Sabil UI

Search documentation

Search for a command to run...

Components

Marker

A compact status line for events in a timeline or activity feed.

Switched to a new branch
Thinking...
Conversation compacted
Explored 4 files

Installation#

  1. Install the dependencies

    npm install class-variance-authority cn radix-ui
  2. Copy the source into your project

    components/ui/marker.tsx
    import * as React from "react"import { cva, type VariantProps } from "class-variance-authority"import { cn } from "cn"import { Slot } from "radix-ui"const markerVariants = cva(  "group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-sm text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground",  {    variants: {      variant: {        default: "",        separator:          "before:mr-1 before:h-px before:min-w-0 before:flex-1 before:bg-border after:ml-1 after:h-px after:min-w-0 after:flex-1 after:bg-border",        border: "border-b border-border pb-2",      },    },  })function Marker({  className,  variant = "default",  asChild = false,  ...props}: React.ComponentProps<"div"> &  VariantProps<typeof markerVariants> & {    asChild?: boolean  }) {  const Comp = asChild ? Slot.Root : "div"  return (    <Comp      data-slot="marker"      data-variant={variant}      className={cn(markerVariants({ variant, className }))}      {...props}    />  )}function MarkerIcon({ className, ...props }: React.ComponentProps<"span">) {  return (    <span      data-slot="marker-icon"      aria-hidden="true"      className={cn(        "size-4 shrink-0 [&_svg:not([class*='size-'])]:size-4",        className      )}      {...props}    />  )}function MarkerContent({ className, ...props }: React.ComponentProps<"span">) {  return (    <span      data-slot="marker-content"      className={cn(        "min-w-0 wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",        className      )}      {...props}    />  )}export { Marker, MarkerIcon, MarkerContent, markerVariants }
  3. Make sure the foundation is in place

    Components read their colors, radius and surfaces from the tokens in app/globals.css. See Theming.

Usage#

import { Marker, MarkerIcon, MarkerContent } from "@/components/ui/marker"

Examples#

Border

Switched to release-candidate
Reviewed 8 related files
Opened implementation notes

Icon

Switched to a new branch
Explored 4 files
Syncing completed
View the pull request

Separator

Today
Worked for 42s
Conversation compacted

Shimmer

Thinking...
Reading 4 files

Status

Compacting conversation
Running tests

Variants

A default marker for inline notes.
A separator marker
A border marker for row boundaries.