1.1.26 • Published 4 months ago

datepickerfromscratch v1.1.26

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

datepickerfromscratch

A custom date picker component for React applications, built with Vite and TypeScript.

Installation

Install the package using npm:

  npm i datepickerfromscratch

Usage

Import the DatePicker component and its stylesheet in your React application:

  import { useState } from 'react';
  import { DatePicker } from 'datepickerfromscratch';
  import 'datepickerfromscratch/style.css';

Then, in the same folder than the file where you call the component DatePicker, create a file named datepickerfromscratch.d.ts containing:

declare module 'datepickerfromscratch';

And you are set!

Example usage in a component:

  function App() {
    const [selectedDate, setSelectedDate] = useState(null);

    const handleDateChange = (date) => {
      setSelectedDate(date);
    };

    return (
      <DatePicker
        id="my-datepicker"
        selectedDate={selectedDate}
        onChange={handleDateChange}
      />
    );
  }

  export default App;

Set the selectedDate state to control the date picker and use the onChange handler to receive the selected date.

Props

NameTypeRequiredDescription
idstringYesUnique identifier for the date picker.
selectedDateDateNoThe currently selected date.
onChangefunctionYesCallback function when the date is changed.
...........................................................................

Dependencies

This component does not require any additional dependencies to be installed by the library user.

Dependencies

Documentation is available in /out/global.html

1.1.9

4 months ago

1.1.8

4 months ago

1.1.7

4 months ago

1.1.6

4 months ago

1.1.12

4 months ago

1.1.11

4 months ago

1.1.10

4 months ago

1.1.16

4 months ago

1.1.15

4 months ago

1.1.14

4 months ago

1.1.13

4 months ago

1.1.19

4 months ago

1.1.18

4 months ago

1.1.17

4 months ago

1.1.23

4 months ago

1.1.22

4 months ago

1.1.21

4 months ago

1.1.20

4 months ago

1.1.26

4 months ago

1.1.25

4 months ago

1.1.24

4 months ago

1.1.5

4 months ago

1.1.1

4 months ago

1.1.0

4 months ago

1.0.9

4 months ago

1.0.8

4 months ago

1.0.7

4 months ago

1.1.4

4 months ago

1.1.3

4 months ago

1.1.2

4 months ago

1.0.2

4 months ago

1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

4 months ago

1.0.1

4 months ago

1.0.0

5 months ago