my/ui

Command Palette

Search for a command to run...

All components

Emoji Rating Slider

sliders

Origin UI component.

responsive · 600px

Install

Same command in any shadcn project — React (Vite/CRA), Next.js, Remix, Astro, and more:

$npx shadcn@latest add https://your-domain/r/comp-256.json

Usage

import Cmp from "@/registry/origin-ui/comp-256";

export default function Demo() {
  return <Cmp />;
}

Component source

"use client";

import { useState } from "react";

import { Label } from "@/components/ui/label";
import { Slider } from "@/components/ui/slider";

export default function Component() {
  const [value, setValue] = useState([3]);

  const labels = ["Awful", "Poor", "Okay", "Good", "Amazing"];

  return (
    <div className="space-y-3">
      <div className="flex items-center justify-between gap-2">
        <Label className="leading-6">Rate your experience</Label>
        <span className="font-medium text-sm">{labels[value[0] - 1]}</span>
      </div>
      <div className="flex items-center gap-2">
        <span className="text-2xl">😡</span>
        <Slider
          aria-label="Rate your experience"
          max={5}
          min={1}
          onValueChange={setValue}
          value={value}
        />
        <span className="text-2xl">😍</span>
      </div>
    </div>
  );
}

Source: Origin UI