All Projects → uselessdev → datepicker

uselessdev / datepicker

Licence: other
A simple datepicker with Chakra-UI and date-fns

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to datepicker

chakra-dayzed-datepicker
Chakra UI + Dayzed = datepicker
Stars: ✭ 44 (-68.57%)
Mutual labels:  datepicker, chakra-ui
s-date-range-picker
📅 A date range picker built with Svelte
Stars: ✭ 13 (-90.71%)
Mutual labels:  datepicker, date-fns
ml gallery
This is a master project of some experiments with Neural Networks. Every project here is runnable, visualized and explained clearly.
Stars: ✭ 18 (-87.14%)
Mutual labels:  chakra-ui
persian-mobile-datepicker
Modern React Persian Mobile Date and Time picker
Stars: ✭ 93 (-33.57%)
Mutual labels:  datepicker
cairo-by-example
Verbosely Documented, Minimal Starknet Contract Examples.
Stars: ✭ 63 (-55%)
Mutual labels:  chakra-ui
flutter date picker timeline
Gregorian and Jalali customizable date picker as a horizontal timeline
Stars: ✭ 29 (-79.29%)
Mutual labels:  datepicker
nikolovlazar.com
My personal site's repo built using Next.js, Chakra UI, MDX, Prisma, PlanetScale.
Stars: ✭ 126 (-10%)
Mutual labels:  chakra-ui
connect-metamask-react-dapp
Build a simple React / Web3 Dapp that replicates a small portion of the Uniswap v2 interface
Stars: ✭ 204 (+45.71%)
Mutual labels:  chakra-ui
laurabeatris.com
My portfolio built with Next.js, Chakra UI and GraphCMS
Stars: ✭ 137 (-2.14%)
Mutual labels:  chakra-ui
ng-persian-datepicker
Persian datepicker for angular 12+
Stars: ✭ 62 (-55.71%)
Mutual labels:  datepicker
egghead-getting-started-with-chakra-ui
This is the project that's part of the egghead.io course Getting Started with Chakra UI.
Stars: ✭ 74 (-47.14%)
Mutual labels:  chakra-ui
Blazor.PersianDatePicker
A free JavaScript Jalali (Persian) and Gregorian (Miladi) dual datepicker library for Blazor applications
Stars: ✭ 40 (-71.43%)
Mutual labels:  datepicker
tailwind-datepicker
A Tailwind CSS datepicker built with vanilla JavaScript
Stars: ✭ 105 (-25%)
Mutual labels:  datepicker
octoclairvoyant-webapp
Compare GitHub changelogs across multiple releases in a single view.
Stars: ✭ 45 (-67.86%)
Mutual labels:  chakra-ui
flitz
The Feed App Boilerplate - built on Blitz.js
Stars: ✭ 32 (-77.14%)
Mutual labels:  chakra-ui
Chakra-UI-Admin-Dashboard-Template
Collection of custom made components using Chakra UI.
Stars: ✭ 64 (-54.29%)
Mutual labels:  chakra-ui
react-calendar
A no dependencies, lightweight and feature-rich ⚡ calendar component for react.
Stars: ✭ 68 (-51.43%)
Mutual labels:  datepicker
luck-or-hardwork
Simple web-app to provide illustration about a take on luck and hard work.
Stars: ✭ 29 (-79.29%)
Mutual labels:  chakra-ui
NodaTimePicker
A Date/Time picker component library for Blazor using NodaTime
Stars: ✭ 49 (-65%)
Mutual labels:  datepicker
jquery-datepicker
A full-featured datepicker jquery plugin
Stars: ✭ 35 (-75%)
Mutual labels:  datepicker

Datepicker

All Contributors

A simple datepicker component build with date-fns and Chakra-UI.

Table of Contents

Requisites

You need to install date-fns and chakra-ui in order to use this library.

yarn add date-fns

To install chakra-ui follow their guide here.

Installation and Usage

After install these dependencies you can now install the library and use this as below:

yarn add @uselessdev/datepicker

Before to use this you can create your own theme or use the default one.

import { ChakraProvider } from '@chakra-ui/react'
import {
  Calendar,
  CalendarDefaultTheme,
  CalendarControls,
  CalendarPrevButton,
  CalendarNextButton,
  CalendarMonths,
  CalendarMonth,
  CalendarMonthName,
  CalendarWeek,
  CalendarDays,
} from '@uselessdev/datepicker'

export function App() {
  const [dates, setDates] = useState()

  const handleSelectDate = (values) => setDates(values)

  return (
    return (
      <ChakraProvider theme={CalendarDefaultTheme}>
        <Calendar value={dates} onSelectDate={handleSelectDate}>
          <CalendarControls>
            <CalendarPrevButton />
            <CalendarNextButton />
          </CalendarControls>

          <CalendarMonths>
            <CalendarMonth>
              <CalendarMonthName />
              <CalendarWeek />
              <CalendarDays />
            </CalendarMonth>
          </CalendarMonths>
        </Calendar>
      </ChakraProvider>
    )
  )
}

note that the example above doens't render an input but only the calendar

If you want to use this with inputs and a popover you can see this example

Customizing

You can fully customize the Calendar component using the extendTheme provided by chakra-ui, you can see an example below.

In your theme you can overrides the default theme (you can see all available components keys for theme customization here)

import { extendTheme } from '@chakra-ui/react'
import { CalendarDefaultTheme } from '@uselessdev/datepicker'

export const theme = extendTheme(CalendarDefaultTheme, {
  components: {
    Calendar: {
      parts: ['calendar'],

      baseStyle: {
        calendar: {
          borderWidth: '6px',
          borderColor: 'pink.400',
          rounded: 'none',
          shadow: 'none',
          boxShadow: '32px 16px 0 6px #3B4DCC'
        },
      },
    },

    CalendarControl: {
      parts: ['button'],

      baseStyle: {
        button: {
          h: 6,
          px: 2,
          rounded: 'none',
          fontSize: 'sm',
          color: 'white',
          bgColor: 'pink.400',

          _hover: {
            bgColor: 'pink.200',
          },

          _focus: {
            outline: 'none',
          },
        },
      },
    }
  },
})

Now you can use this theme in ChakraProvider:

import { ChakraProvider } from '@chakra-ui/react'
import { theme } from './theme'

function App() {
  return (
    <ChakraProvider theme={theme}>
      {/* children... */}
    </ChakraProvider>
  )
}

Theses changes will produce the following results in Calendar:

Customized calendar

Available components theme keys

Key name Description Parts
Calendar A multipart component this is reponsible for the calendar it self. calendar, months
CalendarMonth Responsible to style one month block. month, name, week, weekday, days
CalendarDay Applies styles to individual day. This is the only single part component. --
CalendarControl Applies styles to prev and next months. controls, button

License

This code is under the Apache-2.0 License

Contributors

Thanks goes to these wonderful people (emoji key):


Wallace Batista

💻 🤔

Leonardo Elias

💻

kivi

💻

Guilherme Teixeira

💻

Brano Zavracky

💻

O. Qudah

📖

Tom Chen

📖 💻

Alexandre Stahmer

💻

Raphael da Rocha Pinto Barboza

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].