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

Inputs

Duration Picker

Inputs

Duration Picker React component for Tailwind CSS v4

Date Time PickerEmail Input
Live props
Appearance
size
radius
surfaceColor
labelColor
valueColor
accentColor
Layout
gap8px
Behavior
maxHours24
maxMinutes60
defaultEditing
Content
hoursLabel
minutesLabel
editLabel
saveLabel
State
disabled
Code
import DurationPicker from "@/components/ui/duration-picker"

<DurationPicker />
  1. Home
  2. Components
  3. Inputs
  4. Duration Picker
Free

Duration Picker React component for Tailwind CSS v4

v1.0.1·Updated in 1.2.1

A React duration picker for hours and minutes whose pill springs apart into editable fields.

Click the pen to spring the segments apart and start editing; the hours field is focused for you and the pen morphs into a tick. Type your values. Anything past the ceiling (24 hr and 60 min by default) clamps to the max and shakes so you know it was corrected. Click the tick to confirm and watch the pill merge back into one piece.

Duration Picker is a free React component in the React input components category, written in TypeScript for React 19 and Tailwind CSS v4. It installs as source with npx wingo-ui@latest add duration-picker, together with Motion presets and UIProvider and the npm packages motion, figma-squircle, flubber, react-use-measure and @radix-ui/react-slot.

Add to a project

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

npx wingo-ui@latest add duration-picker

Usage

Import DurationPicker from @/components/ui/duration-picker.

"use client"

import { useState } from "react"
import DurationPicker, { type DurationValue } from "@/components/ui/duration-picker"

export function Demo() {
  const [duration, setDuration] = useState<DurationValue>({ hours: 1, minutes: 30 })

  return (
    <DurationPicker
      size="md"
      value={duration}
      onChange={setDuration}
      onConfirm={(d) => console.log("saved", d)}
    />
  )
}

// zero config, fully uncontrolled
// <DurationPicker onConfirm={(d) => console.log("saved", d)} />

Props

  • sizedefault "md"
    "sm" | "md" | "lg"

    Overall scale. The pill is 40px (sm, 44px on touch screens), 48px (md) or 56px (lg) tall, and the corner radius, the open field width, the icon and the text size scale with it.

  • radiusdefault "md"
    "none" | "sm" | "md" | "lg" | "full"

    Outer corner radius of the squircle: square, tighter, the original 10 / 12 / 14px per size, rounder, or a pill. The inner corners open up from it while editing.

  • surfaceColordefault "auto"
    string

    Fill of the three segments, any CSS color. Auto is a soft gray that follows the light and dark theme. A translucent tint keeps the digits readable in both themes.

  • labelColordefault "auto"
    string

    Color of the Hr. and Min. labels, any CSS color. Auto is a muted gray tuned per theme.

  • valueColordefault "auto"
    string

    Color of the typed digits, any CSS color. Auto is black on light pages and white on dark ones.

  • accentColordefault "#868593"
    string

    Color of the pen icon and the tick it morphs into, any CSS color.

  • gapdefault 8
    number

    Space in pixels the three segments spread apart to while editing.

  • maxHoursdefault 24
    number

    Ceiling for the hours field. Typing past it clamps to this value and shakes the input.

  • maxMinutesdefault 60
    number

    Ceiling for the minutes field. Same clamp and shake behavior as maxHours.

  • defaultEditingdefault false
    boolean

    Renders the picker already open in edit mode, with the tick showing.

  • hoursLabeldefault "Hr."
    string

    Text rendered after the hours field. Swap it for a translation or a terser h.

  • minutesLabeldefault "Min."
    string

    Text rendered after the minutes field.

  • editLabeldefault "Edit duration"
    string

    Accessible name of the pen button while the picker is closed.

  • saveLabeldefault "Save duration"
    string

    Accessible name of the tick button while editing.

  • disableddefault false
    boolean

    Dims the control to half opacity and blocks entering edit mode.

  • value
    { hours: number; minutes: number }

    Controlled value. Pair it with onChange and the picker mirrors whatever you pass in. Leave it out to let the component manage its own state.

  • defaultValue
    { hours: number; minutes: number }

    Starting value for uncontrolled usage. Ignored when value is provided. Left out, both fields start empty and show a 0 placeholder.

  • onChange
    (value: DurationValue) => void

    Fires on every keystroke with the current clamped value. Listen here to react while the user types.

  • onConfirm
    (value: DurationValue) => void

    Fires once with the final clamped value when the tick is clicked. This is usually the one you want for saving.

  • onEditingChange
    (editing: boolean) => void

    Fires when the picker enters or leaves edit mode, handy for blocking navigation or dimming surrounding UI while it is open.

  • className
    string

    Extra classes merged onto the root; other div props are spread onto it too. Every inner part carries a data-slot (duration-picker, duration-picker-segment, duration-picker-input, duration-picker-toggle) plus data-editing, data-disabled and data-size states, and the colors live in the --duration-picker-surface, --duration-picker-label and --duration-picker-value variables, so you can restyle from CSS alone.

Parts

  • DurationValue

    type

    The value shape for value, defaultValue, onChange and onConfirm: { hours: number; minutes: number }.

Examples

Logging time on a task

onConfirm fires once with the final value when the tick is pressed, which is the moment to save the entry.

Custom limits and labels

maxHours and maxMinutes set the ceilings, so anything above them clamps and shakes; short labels keep the pill compact.

Sizes

sm, md and lg are 40, 48 and 56px tall, with the corners, field and icon scaled to match.

Tinted

A translucent surface with a matching label and icon color reads well in both themes.

Dependencies

motionfigma-squircleflubberreact-use-measure@radix-ui/react-slotmotionui-config

Files

  • components/ui/duration-picker.tsx

FAQ

Is the React Duration Picker component 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 Duration Picker?

Run npx wingo-ui@latest add duration-picker. It also adds the Wingo UI items it builds on (Motion presets and UIProvider) and the npm packages motion, figma-squircle, flubber, react-use-measure and @radix-ui/react-slot. With shadcn, run npx shadcn@latest add https://wingo-ui.com/r/duration-picker.json.

See also

Time PickerNumber InputDate Time PickerCountdownPicker Wheel

More React input components

OTP InputAvatar UploadColor PickerCalendarSliderSwitch
All 40 React input components
PreviousDate Time PickerNext Email Input
0Hr.
0Min.

Click the pen to edit, then the tick to save.