@sankarbala/datepicker
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

@React Datepicker

A simple datepicker for react/typescript component.

You can set an id, name, placeholder, a onChange callback, className and a preselected value via props.

See demo link

Installation

The package can be installed via npm or yarn:

npm install @sankarbala/datepicker
yarn add @sankarbala/datepicker

Usage

import React, { useState } from "react";
import { DatePicker } from "@sankarbala/datepicker";

const MyForm = ({ data }) => {
  const [date, setDate] = useState("01/02/2023");

  const handleInputChanged = ({ e }) => {
    setDate(e.target.value);
  };

  <DatePicker
    id="birthday"
    name="birthday"
    onChange={handleInputChanged}
    value={date}
    className="form-control"
  />;
};

Props

id : an optional id for the datepicker (optional:string)
name : an optional name for the datepicker (optional:string)
placeholder : a placeholder string (optional:string)
value : set the value of the datepicker input (optional:date)
onChange : a callback function that takes as argument (target:func)
className : an optional attribute for the datepicker (optional:string)
disabled : an optional attribute for the datepicker (optional:boolean)
otherAttributes : an optional attribute for object of the rest attributes the datepicker (optional:object)

Readme

Keywords

none

Package Sidebar

Install

npm i @sankarbala/datepicker

Weekly Downloads

0

Version

1.0.5

License

none

Unpacked Size

28.9 kB

Total Files

9

Last publish

Collaborators

  • sankarbala