Skip to content

Feat: Added component: DateRangeInput #40

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

benbarnett02
Copy link
Contributor

New component: DateRangeInput
DateRangeInput provides similar behaviour to the DateInput component for date ranges, displaying a DateRangePicker in a DropdownWrapper on click of an Input box.

While it can work uncontrolled, it works best with state controlled by a parent component via the value & onChange props (although I can improve the uncontrolled behaviour if that is desired?)

Usage:

// Import
import { DateRangeInput, DateRange } from "@/once-ui/components";

// State
const [selectedRange, setSelectedRange] = useState<DateRange>();

// Use component
<DateRangeInput 
    id={"daterangepicker"} 
    value={selectedRange} 
    onChange={setSelectedRange} 
    startLabel={"Check in"} 
    endLabel={"Check out"} 
/>

DateRangeInput provides similar behaviour to the DateInput component for date ranges, displaying a DateRangePicker in a DropdownWrapper on click of an Input box.
Copy link

vercel bot commented Mar 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
once-ui-starter ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 30, 2025 7:37am

…geInput component for improved appearance when input is displayed in smaller widths.
@benbarnett02
Copy link
Contributor Author

Did some testing and found that it looks pretty terrible in smaller widths so have fixed that.

Before:
Screenshot 2025-03-30 182725

After:
image

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant