ReScript Shadcn
Get started
  • Installation
Components
  • Accordion
  • Alert
  • AlertDialog
  • AspectRatio
  • Attachment
  • Avatar
  • Badge
  • Breadcrumb
  • Bubble
  • Button
  • ButtonGroup
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Collapsible
  • Combobox
  • Command
  • ContextMenu
  • DataTable
  • DatePicker
  • Dialog
  • Direction
  • Drawer
  • DropdownMenu
  • Empty
  • Field
  • HoverCard
  • Input
  • InputGroup
  • InputOtp
  • Item
  • Kbd
  • Label
  • Marker
  • Menubar
  • Message
  • MessageScroller
  • NativeSelect
  • NavigationMenu
  • Pagination
  • Popover
  • Progress
  • RadioGroup
  • Resizable
  • ScrollArea
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Sonner
  • Spinner
  • Switch
  • Table
  • Tabs
  • Textarea
  • Toast
  • Toggle
  • ToggleGroup
  • Tooltip
  • Typography

Spinner

An indicator that can be used to show a loading state.

Processing payment...
$100.00

Installation#

npx shadcn@latest add @rescript-shadcn/Spinner

Usage#

<Spinner />

Customization#

You can replace the default spinner icon with any other icon by editing the Spinner component.

components/ui/Spinner.res
@module("tailwind-merge")
external cn: (string, option<string>) => string = "twMerge"
 
@react.component
let make = (~className=?, ~dataIcon=?, ~dataSlot=?) => {
  <LoaderIcon
    ?dataIcon
    ?dataSlot
    role="status"
    ariaLabel="Loading"
    className={cn("size-4 animate-spin", className)}
  />
}
 

Examples#

Size#

Use the size-* utility class to change the size of the spinner.

Button#

Add a spinner to a button to indicate a loading state. Remember to use the dataIcon=InlineStart prop to add the spinner to the start of the button and the dataIcon=InlineEnd prop to add the spinner to the end of the button.

Badge#

Add a spinner to a badge to indicate a loading state. Remember to use the dataIcon=InlineStart prop to add the spinner to the start of the badge and the dataIcon=InlineEnd prop to add the spinner to the end of the badge.

SyncingUpdatingProcessing

Input Group#

Validating...

Empty#

Processing your request
Please wait while we process your request. Do not refresh the page.
@react.component
let make = () =>
  <div className="flex items-center gap-4">
@react.component
let make = () =>
  <div className="flex w-full max-w-xs flex-col gap-4 [--radius:1rem]">
@react.component
let make = () =>
  <div className="flex items-center gap-6">
@react.component
let make = () =>
  <div className="flex items-center gap-4 [--radius:1.2rem]">
@react.component
let make = () =>
  <div className="flex flex-col items-center gap-4">
@react.component
let make = () =>
  <div className="flex w-full max-w-md flex-col gap-4">
@react.component
let make = () =>
  <Empty className="w-full">