Skip to content
WingoUI
ComponentsTemplatesDocsPricingAI agentsBlogChangelogContact
Components
Buttons & Actions
ButtonButton GroupCopy ButtonDelete ButtonTheme ToggleToggleToggle Group
Inputs
Avatar UploadCalendarCheckboxColor PickerComboboxCountry SelectCron PickerCurrency InputDate PickerDate Range PickerDate Time PickerDuration PickerEmail InputEmoji PickerFile UploadFilter BuilderInputInput GroupListboxMasked InputMention InputMonth PickerMulti SelectNumber InputOTP InputPassword InputPhone InputRadio GroupRatingSearch InputSegmented ControlSelectSignature PadSliderSwitchTag InputTextareaTime PickerTimezone SelectTree Select
Forms
Address InputBooking WidgetCSV ImportFieldForm WizardInline EditInvoice line itemsRich Text EditorSchema Builder
Navigation
Back To TopBounce SidebarBreadcrumbCommand MenuGlobal SearchGooey NavHook SidebarNav MenuNav TabsPaginationProximity SidebarScroll ProgressSidebarStepsTable Of ContentsTabsTopbarUser MenuWorkspace Switcher
Overlays
Alert DialogContext MenuDialogDrawerDropdown MenuFamily DrawerHover CardPopoverShare DialogSheetShortcuts DialogTooltipTour
Feedback
AlertBannerCookie ConsentEmoji ReactionEmpty StateNotification BellNotification CenterProgressRoute ProgressSetup ChecklistSkeletonSpinnerToast
Data Display
Approval FlowAvatarBadgeCalendar ViewCode BlockComment ThreadContact cardCountdownDescription ListDiff ViewerFile ListFile managerFolderGanttJSON ViewerKbdLog ViewerMarkdownPresenceSchedulerTagTimelineTree View
Tables & Lists
Audit LogData TableDeal PipelineEditable GridKanbanListMembers tablePermissions MatrixTableTask ListVirtual List
Charts & Stats
Animated CounterArea chartBar chartDonut chartFunnel chartGaugeGitHub ActivityHeatmap calendarLeaderboardLine chartRadar chartRadial barSparklineStat CardTrackerTrend badge
Layout
AccordionApp ShellCardCollapsibleDetail LayoutEntity HeaderPage HeaderScroll AreaSeparatorSettings LayoutSplit ViewToolbar
Media
Audio PlayerCarouselCSV ViewerDOCX EditorDOCX ViewerExcel ViewerFile SystemImage compareImage CropperImage GalleryImage LightboxLocation MapPDF ViewerPowerPoint ViewerQR CodeStep PlayerVideo Player
AI Kit
Agent Status CardChat MessageChat ThreadChat WidgetConversation ListFluid OrbGrid RevealMatrix OrbModel PickerPrompt InputReasoning IndicatorRule BuilderSuggestion ChipsTool Call TimelineUsage MeterVoice InputWorkflow Canvas
Text & Effects
Background PatternGravity LettersMarqueeTerminalText AnimateText Rotate
Mobile
Action SheetBottom Tab BarFABHaptic ButtonHero HeaderInstall PromptLarge Title HeaderNotification BannerOnboarding CarouselPicker WheelPull To RefreshSlide To ConfirmSticky CTA BarSwipe DeckSwipeable Tabs
Commerce
Cart drawerCategory pickerCheckout stepsCoupon inputFavorite buttonFilter panelListing cardListing gridOrder trackerPricePrice rangePricing tableProduct galleryQuantity stepperReviewsSeller card
Marketing Sections
App Download SectionBlog Cards SectionCTA SectionFAQ SectionFeature GridFeature ShowcaseHero SectionIntegrations SectionLogo CloudMarketing FooterMarketing HeaderMarketing SectionNewsletter SectionPricing SectionStats SectionSteps SectionTeam SectionTestimonials SectionTimeline SectionVideo Section
Blocks
Admin Dashboard PageAdmin ShellAI Chat PageAPI Keys PageAutomation Builder PageCheckout PageCRM Contact PageCRM Pipeline PageError PagesInbox PageInvoice PageKPI DashboardListing Detail PageLogin PageMarketplace Home PageMarketplace Search PageMarketplace ShellMobile App HomeOnboarding FlowOrder History PagePost Listing WizardPricing PageProfile PageRegister PageSettings PageUsers Admin Page
Templates
About PageAcademy PageAccessibility PageAffiliate PageAgency PageAI Product PageAppointment Booking PageBlog PageBlog Post PageBug Bounty PageCareers PageChangelog PageCommunity PageCompare PageContact PageCustomer Story PageCustomers PageDemo Booking PageDevelopers PageDocs Home PageDownload PageEnterprise PageEvents PageExperts PageFAQ PageFeature PageGlossary PageHelp Article PageHelp Center PageHome Services PageImpact PageIntegration Detail PageIntegrations PageJob Detail PageLanding PageLaunch PageLegal PageManifesto PagePortfolio PagePress PageProduct Tour PagePromo PageReal Estate PageReferral PageResearch Report PageRestaurant PageRoadmap PageROI Calculator PageSecurity PageSolutions PageStartups PageStatus PageStorefront PageSwitch PageTemplate Gallery PageTravel PageWaitlist PageYear in Review Page
Hooks & Utilities
AI ChatChart kitCommerceDate utilsFile exportFile typesFiltersForm validationHapticsInvoicingMotion presetsNavigationNumber formatRelative timeRomanian locationsSpreadsheetText matchTonesUIProvideruseClipboarduseConsentuseControllableStateuseCooldownuseDebounceuseKeyboardInsetuseLocaleuseLongPressuseMediaControlsuseMediaQueryuseOverflowItemsusePersistedStateuseScrollEdgesuseScrollStateuseSelectionuseShortcutuseStickToBottom
GalleryTheme

Hooks & Utilities

Tones

Hooks & Utilities

Tones TypeScript helper for React

Text matchUIProvider
Live props
Options
color
  1. Home
  2. Components
  3. Hooks & Utilities
  4. Tones
Free

Tones TypeScript helper for React

v1.0.0·Added in 1.0.0

One way to color a React component: a tone or any CSS color becomes five CSS variables every variant paints with.

Each row is one tone painted three ways: a solid fill, a soft tint and an outline. Pick any color in the playground to see colorVars build the same set from it, with readable text on both themes.

Tones is a free React helper in the React hooks and utilities category, written in TypeScript for React 19. It installs as source with npx wingo-ui@latest add tones.

Add to a project

Requirements: React 19, in Next.js (App Router or Pages), Vite or React Router. Installation guide · Next.js setup · Vite setup

npx wingo-ui@latest add tones

Usage

Import toneClasses from @/lib/tones.

import { colorVars, toneClasses, type Tone } from "@/lib/tones"
import { cn } from "@/lib/utils"

export function Badge({ tone = "neutral", color, className, ...props }: React.ComponentProps<"span"> & { tone?: Tone; color?: string }) {
  return (
    <span
      data-slot="badge"
      className={cn(toneClasses[tone], "rounded-full bg-(--tone-soft) px-2 py-0.5 text-xs font-medium text-(--tone-soft-foreground)", className)}
      style={colorVars(color)}
      {...props}
    />
  )
}

API

  • colordefault "#7C3AED"
    string

    colorVars(color): any CSS color turned into the five --tone-* vars, for a component's color prop.

  • toneClasses
    Record<"neutral" | "brand" | "success" | "warning" | "danger" | "info", string>

    Classes that set --tone, --tone-foreground, --tone-soft, --tone-soft-foreground and --tone-border from the design tokens.

Parts

  • colorVars

    function

    The same vars as an inline style. The text on the fill turns black or white by lightness; soft text mixes toward the foreground. Signature: (color?: string) => CSSProperties | undefined.

  • TONES

    constant

    Every tone in order, and a guard that turns an unknown string into a tone. Type: Tone[].

  • toTone

    function

    Every tone in order, and a guard that turns an unknown string into a tone. Signature: (value: unknown, fallback?: Tone) => Tone.

Examples

Invoice status badges

One badge component; toneClasses maps paid, pending, overdue and draft to success, warning, danger and neutral.

Brand colors

colorVars turns any hex color into the same five variables, with text that stays readable on a light amber.

Dependencies

No dependencies beyond React.

Files

  • lib/tones.ts

FAQ

Is the Tones helper free?

Yes. The source is free and needs no account: copy it from the Code tab or install it with the CLI.

How do I install Tones?

Run npx wingo-ui@latest add tones. With shadcn, run npx shadcn@latest add https://wingo-ui.com/r/tones.json.

See also

ButtonMotion presetslib

Used in

Listing cardBadgeGaugeAvatar UploadHero HeaderBottom Tab BarOnboarding FlowCalendarSliderFavorite buttonTooltipVideo Player

and 239 more.

More React hooks and utilities

UIProviderlibuseClipboardhookuseConsenthookuseControllableStatehookuseCooldownhookuseDebouncehook
All 36 React hooks and utilities

Articles using this component

  • shadcn Tailwind v4 Migration: Step by Step From v3

    Next.js and Tailwind CSS · Nov 6, 2026 · 10 min read

  • Claude Code Design System: Make 50 Screens Match

    Building UI with AI agents · Oct 16, 2026 · 12 min read

  • Tailwind v4 Dark Mode: Class Toggle, Tokens, next-themes

    Next.js and Tailwind CSS · Oct 13, 2026 · 9 min read

  • Tailwind v4 Design Tokens: Colors, Dark Mode and Contrast

    Next.js and Tailwind CSS · Oct 9, 2026 · 20 min read

PreviousText matchNext UIProvider
NeutralSolidSoftOutline
BrandSolidSoftOutline
SuccessSolidSoftOutline
WarningSolidSoftOutline
DangerSolidSoftOutline
InfoSolidSoftOutline
colorVarsSolidSoftOutline

colorVars("#7C3AED")