All Projects → arfedulov → Semantic Ui Calendar React

arfedulov / Semantic Ui Calendar React

Licence: mit
Datepicker react component based on semantic-ui-react components

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Semantic Ui Calendar React

Things Calendar
Simple but elegant datepicker for the web — inspired by Things for mac
Stars: ✭ 165 (-30.96%)
Mutual labels:  datepicker
Vuetify Daterange Picker
The missing date range picker for Vuetify JS you have been looking for.
Stars: ✭ 192 (-19.67%)
Mutual labels:  datepicker
Datepicker
Get a date with JavaScript! A datepicker with no dependencies.
Stars: ✭ 212 (-11.3%)
Mutual labels:  datepicker
React Datepicker
📅 React DatePicker Library (Flexible, Reusable)
Stars: ✭ 165 (-30.96%)
Mutual labels:  datepicker
Android Pickerview
This is a picker view for android , support linkage effect, timepicker and optionspicker.(时间选择器、省市区三级联动)
Stars: ✭ 13,003 (+5340.59%)
Mutual labels:  datepicker
Hotel Datepicker
Date range picker for hotels
Stars: ✭ 202 (-15.48%)
Mutual labels:  datepicker
Vue Ui For Pc
基于Vue2.x的一套PC端UI组件,包括了Carousel 跑马灯、Cascader 级联、Checkbox 多选框、Collapse 折叠面板、DatePicker 日期选择、Dialog 对话框、Form 表单、Input 输入框、InputNumber 数字输入框、Layer 弹窗层、Loading 加载、Menu 菜单、Page 分页、Progress 进度条、Radio 单选框、SelectDropDown 仿select、Switch 开关、Table 表格、Tabs 标签页、Textarea 文本框、Tooltip 文字提示、BackTop 返回顶部、steps 步骤条、Transfer 穿梭框、Tree 树形、Upload 文件上传、Lazy 图片懒加载、Loading 加载、Pagination 分页等等
Stars: ✭ 156 (-34.73%)
Mutual labels:  datepicker
Calendarview
A highly customizable calendar library for Android, powered by RecyclerView.
Stars: ✭ 2,862 (+1097.49%)
Mutual labels:  datepicker
Material Ui Pickers
Date & Time pickers, built with ❤️ for @material-ui/core
Stars: ✭ 2,291 (+858.58%)
Mutual labels:  datepicker
Persian Date Picker Dialog
Persian Date Picker Dialog for Android
Stars: ✭ 205 (-14.23%)
Mutual labels:  datepicker
Brpickerview
BRPickerView 封装的是iOS中常用的选择器组件,主要包括:日期选择器(支持年月日、年月等15种日期样式选择,支持设置星期、至今等)、地址选择器(支持省市区、省市、省三种地区选择)、自定义字符串选择器(支持单列、多列、二级联动、三级联动选择)。支持自定义主题样式,适配深色模式,支持将选择器组件添加到指定容器视图。
Stars: ✭ 2,149 (+799.16%)
Mutual labels:  datepicker
React Native Paper Dates
Smooth and fast cross platform Material Design date and time picker for React Native Paper
Stars: ✭ 173 (-27.62%)
Mutual labels:  datepicker
Lightpick
(deprecated) Check out the new date picker Litepicker
Stars: ✭ 204 (-14.64%)
Mutual labels:  datepicker
Ng2 Datetime
Datetime picker plugins wrapper for Angular2+
Stars: ✭ 165 (-30.96%)
Mutual labels:  datepicker
Vue Bootstrap Datetimepicker
Vue.js component for eonasdan bootstrap datetimepicker
Stars: ✭ 221 (-7.53%)
Mutual labels:  datepicker
Datepickk
Simple, beautiful and powerful datepicker!
Stars: ✭ 160 (-33.05%)
Mutual labels:  datepicker
React Datepicker2
react datepicker component.(include persian jalaali calendar)
Stars: ✭ 191 (-20.08%)
Mutual labels:  datepicker
Flatpickr
lightweight, powerful javascript datetimepicker with no dependencies
Stars: ✭ 14,575 (+5998.33%)
Mutual labels:  datepicker
Vuejs Datepicker
A simple Vue.js datepicker component. Supports disabling of dates, inline mode, translations
Stars: ✭ 2,529 (+958.16%)
Mutual labels:  datepicker
Heyui
🎉UI Toolkit for Web, Vue2.0 http://www.heyui.top
Stars: ✭ 2,373 (+892.89%)
Mutual labels:  datepicker

🎉 Starting with version 0.8.0 it's css free. ⚠️ Uncompatible with semantic-ui-react version 0.83.0

semantic-ui-calendar-react

Datepicker react component based on semantic-ui-react components

My intention was to create something that looks like this https://github.com/mdehoog/Semantic-UI-Calendar.

Here you can find a live example https://arfedulov.github.io/semantic-ui-calendar-react

installation

npm

npm i semantic-ui-calendar-react

CDN

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/semantic-ui-calendar-react.js"></script>

Then you can access calendar components from your scripts like this:

const { DateInput } = SemanticUiCalendarReact;

usage

Let's create a form that needs date-related input fields.

Import input components:

import {
  DateInput,
  TimeInput,
  DateTimeInput,
  DatesRangeInput
} from 'semantic-ui-calendar-react';

Then build a form:

class DateTimeForm extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      date: '',
      time: '',
      dateTime: '',
      datesRange: ''
    };
  }

  handleChange = (event, {name, value}) => {
    if (this.state.hasOwnProperty(name)) {
      this.setState({ [name]: value });
    }
  }

  render() {
    return (
      <Form>
        <DateInput
          name="date"
          placeholder="Date"
          value={this.state.date}
          iconPosition="left"
          onChange={this.handleChange}
        />
        <TimeInput
          name="time"
          placeholder="Time"
          value={this.state.time}
          iconPosition="left"
          onChange={this.handleChange}
        />
        <DateTimeInput
          name="dateTime"
          placeholder="Date Time"
          value={this.state.dateTime}
          iconPosition="left"
          onChange={this.handleChange}
        />
        <DatesRangeInput
          name="datesRange"
          placeholder="From - To"
          value={this.state.datesRange}
          iconPosition="left"
          onChange={this.handleChange}
        />
      </Form>
    );
  }
}

Also you can build a form with inline pickers as inputs. Just set inline prop on input element and it will be displayed as inline picker:

class DateTimeFormInline extends React.Component {
 handleChange = (event, {name, value}) => {
    if (this.state.hasOwnProperty(name)) {
      this.setState({ [name]: value });
    }
  }

  render() {
    return (
      <Form>
        <DateInput
          inline
          name='date'
          value={this.state.date}
          onChange={this.handleDateChange}
        />
      </Form>
    );
  }
}

or you can make it cleanable in the following way,

class ClearableDateTimeForm extends React.Component {
  handleChange = (event, {name, value}) => {
    if (this.state.hasOwnProperty(name)) {
      this.setState({ [name]: value });
    }
  }

  render() {
    return (
      <Form>
        <DateInput
          clearable
          clearIcon={<Icon name="remove" color="red" />}
          name="date"
          value={this.state.date}
          onChange={this.handleDateChange}
        />
      </Form>
    );
  }
}

Locales support

Since semantic-ui-calendar-react uses moment.js it supports locales. You can set locale globally:

import moment from 'moment';
import 'moment/locale/ru';

You can also set locale for *Input component locally using localization prop.

<DateInput localization='ru' />

Supported elements

DateInput

Prop Description
all that can be used with SUIR Form.Input
value {string} Currently selected value; must have format dateFormat.
dateFormat {string} Date formatting string. You can use here anything that can be passed to moment().format. Default: DD-MM-YYYY
popupPosition {string} One of ['top left', 'top right', 'bottom left', 'bottom right', 'right center', 'left center', 'top center', 'bottom center']. Default: top left
inline {bool} If true inline picker displayed. Default: false
startMode {string} Display mode to start. One of ['year', 'month', 'day']. Default: day
closable {bool} If true, popup closes after selecting a date
initialDate {string|moment|Date} Date on which calendar opens. By default it opens on today's date. (Do not be confused by property name. For setting some default value just set into value prop).
disable {string|moment|Date|string[]|moment[]|Date[]} Date or list of dates that are displayed as disabled
enable {string[]|moment[]|Date[]} Date or list of dates that are enabled (the rest are disabled)
maxDate {string|moment} Maximum date that can be selected
minDate {string|moment} Minimum date that can be selected
inlineLabel {bool} A field can have its label next to instead of above it.
closeOnMouseLeave {bool} Should close when cursor leaves calendar popup. Default: true
preserveViewMode {bool} Preserve last mode (day, hour, minute) each time user opens dialog. Default true
mountNode {any} The node where the picker should mount.
onClear {func} Called after clear icon has clicked.
clearable {boolean} Using the clearable setting will let users remove their selection from a calendar.
clearIcon {any} Optional Icon to display inside the clearable Input.
pickerWidth {string} Optional width value for picker (any string value that could be assigned to style.width).
pickerStyle {object} Optional style object for picker.
duration {number} Optional duration of the CSS transition animation in milliseconds. Default: 200
animation {string} Optional named animation event to used. Must be defined in CSS. Default: 'scale'
marked {moment|Date|moment[]|Date[]} Date or list of dates that are displayed as marked
markColor {string|SemanticCOLORs} String specifying the mark color. Must be one of the Semantic UI colors
localization {string} Sets Moment date locale locally for this component.
icon {string|false} icon to display inside Input.
iconPosition {'left'|'right'} icon position inside Input. Default: 'right'.
hideMobileKeyboard {bool} Try to prevent mobile keyboard appearing.

TimeInput

Prop Description
all that can be used with SUIR Form.Input
value {string} Currently selected value; must have format dateFormat.
popupPosition {string} One of ['top left', 'top right', 'bottom left', 'bottom right', 'right center', 'left center', 'top center', 'bottom center']. Default: top left
inline {bool} If true inline picker displayed. Default: false
closable {bool} If true, popup closes after selecting a time
inlineLabel {bool} A field can have its label next to instead of above it.
closeOnMouseLeave {bool} Should close when cursor leaves calendar popup. Default: true
timeFormat {string} One of ["24", "AMPM", "ampm"]. Default: "24"
disableMinute {bool} If true, minutes picker won't be shown after picking the hour. Default: false
mountNode {any} The node where the picker should mount.
onClear {func} Called after clear icon has clicked.
clearable {boolean} Using the clearable setting will let users remove their selection from a calendar.
clearIcon {any} Optional Icon to display inside the clearable Input.
pickerWidth {string} Optional width value for picker (any string value that could be assigned to style.width).
pickerStyle {object} Optional style object for picker.
duration {number} Optional duration of the CSS transition animation in milliseconds. Default: 200
animation {string} Optional named animation event to used. Must be defined in CSS. Default: 'scale'
localization {string} Sets Moment date locale locally for this component.
icon {string|false} icon to display inside Input.
iconPosition {'left'|'right'} icon position inside Input. Default: 'right'.
hideMobileKeyboard {bool} Try to prevent mobile keyboard appearing.

DateTimeInput

Prop Description
all that can be used with SUIR Form.Input
value {string} Currently selected value; must have format dateFormat.
dateTimeFormat {string} Datetime formatting string for the input's value. You can use any string here that can be passed to moment().format. If provided, it overrides dateFormat, divider, and timeFormat. Note: this does not affect the formats used to display the pop-up date and time pickers; it only affects the format of the input's value field. Default: null
dateFormat {string} Date formatting string. You can use any string here that can be passed to moment().format. Default: DD-MM-YYYY. This formats only the date component of the datetime.
timeFormat {string} One of ["24", "AMPM", "ampm"]. Default: "24"
divider {string} Date and time divider. Default:
disableMinute {bool} If true, minutes picker won't be shown after picking the hour. Default: false
popupPosition {string} One of ['top left', 'top right', 'bottom left', 'bottom right', 'right center', 'left center', 'top center', 'bottom center']. Default: top left
inline {bool} If true inline picker displayed. Default: false
startMode {string} Display mode to start. One of ['year', 'month', 'day']. Default: day
closable {bool} If true, popup closes after selecting a date-time
initialDate {string|moment|Date} Date on which calendar opens. By default it opens on today's date. (Do not be confused by property name. For setting some default value just set into value prop).
disable {string|moment|string[]|moment[]} Date or list of dates that are displayed as disabled
maxDate {string|moment} Maximum date that can be selected
minDate {string|moment} Minimum date that can be selected
inlineLabel {bool} A field can have its label next to instead of above it.
closeOnMouseLeave {bool} Should close when cursor leaves calendar popup. Default: true
preserveViewMode {bool} Preserve last mode (day, hour, minute) each time user opens dialog. Default true
mountNode {any} The node where the picker should mount.
onClear {func} Called after clear icon has clicked.
clearable {boolean} Using the clearable setting will let users remove their selection from a calendar.
clearIcon {any} Optional Icon to display inside the clearable Input.
pickerWidth {string} Optional width value for picker (any string value that could be assigned to style.width).
pickerStyle {object} Optional style object for picker.
duration {number} Optional duration of the CSS transition animation in milliseconds. Default: 200
animation {string} Optional named animation event to used. Must be defined in CSS. Default: 'scale'
marked {moment|Date|moment[]|Date[]} Date or list of dates that are displayed as marked
markColor {string|SemanticCOLORs} String specifying the mark color. Must be one of the Semantic UI colors
localization {string} Sets Moment date locale locally for this component.
icon {string|false} icon to display inside Input.
iconPosition {'left'|'right'} icon position inside Input. Default: 'right'.
hideMobileKeyboard {bool} Try to prevent mobile keyboard appearing.

DatesRangeInput

Prop Description
all that can be used with SUIR Form.Input
value {string} Currently selected value; must have format dateFormat.
dateFormat {string} Date formatting string. You can use here anything that can be passed to moment().format. Default: DD.MM.YY
popupPosition {string} One of ['top left', 'top right', 'bottom left', 'bottom right', 'right center', 'left center', 'top center', 'bottom center']. Default: top left
inline {bool} If true inline picker displayed. Default: false
closable {bool} If true, popup closes after selecting a dates range
initialDate {string|moment|Date} Date on which calendar opens. By default it opens on today's date. (Do not be confused by property name. For setting some default value just set into value prop).
maxDate {string|moment} Maximum date that can be selected
minDate {string|moment} Minimum date that can be selected
inlineLabel {bool} A field can have its label next to instead of above it.
closeOnMouseLeave {bool} Should close when cursor leaves calendar popup. Default: true
mountNode {any} The node where the picker should mount.
onClear {func} Called after clear icon has clicked.
clearable {boolean} Using the clearable setting will let users remove their selection from a calendar.
clearIcon {any} Optional Icon to display inside the clearable Input.
pickerWidth {string} Optional width value for picker (any string value that could be assigned to style.width).
pickerStyle {object} Optional style object for picker.
duration {number} Optional duration of the CSS transition animation in milliseconds. Default: 200
animation {string} Optional named animation event to used. Must be defined in CSS. Default: 'scale'
marked {moment|Date|moment[]|Date[]} Date or list of dates that are displayed as marked
markColor {string|SemanticCOLORs} String specifying the mark color. Must be one of the Semantic UI colors
localization {string} Sets Moment date locale locally for this component.
icon {string|false} icon to display inside Input.
iconPosition {'left'|'right'} icon position inside Input. Default: 'right'.
allowSameEndDate {boolean} Allow end date to be the same as start date.
hideMobileKeyboard {bool} Try to prevent mobile keyboard appearing.

YearInput

Prop Description
all that can be used with SUIR Form.Input
value {string} Currently selected value; must have format dateFormat.
popupPosition {string} One of ['top left', 'top right', 'bottom left', 'bottom right', 'right center', 'left center', 'top center', 'bottom center']. Default: top left
inline {bool} If true inline picker displayed. Default: false
closable {bool} If true, popup closes after selecting a year
inlineLabel {bool} A field can have its label next to instead of above it.
closeOnMouseLeave {bool} Should close when cursor leaves calendar popup. Default: true
initialDate {string|moment|Date} Date on which calendar opens. By default it opens on today's date. (Do not be confused by property name. For setting some default value just set into value prop).
mountNode {any} The node where the picker should mount.
onClear {func} Called after clear icon has clicked.
clearable {boolean} Using the clearable setting will let users remove their selection from a calendar.
clearIcon {any} Optional Icon to display inside the clearable Input.
pickerWidth {string} Optional width value for picker (any string value that could be assigned to style.width).
pickerStyle {object} Optional style object for picker.
duration {number} Optional duration of the CSS transition animation in milliseconds. Default: 200
animation {string} Optional named animation event to used. Must be defined in CSS. Default: 'scale'
localization {string} Sets Moment date locale locally for this component.
icon {string|false} icon to display inside Input.
iconPosition {'left'|'right'} icon position inside Input. Default: 'right'.
hideMobileKeyboard {bool} Try to prevent mobile keyboard appearing.

MonthInput

Prop Description
all that can be used with SUIR Form.Input
value {string} Currently selected value; must have format dateFormat.
popupPosition {string} One of ['top left', 'top right', 'bottom left', 'bottom right', 'right center', 'left center', 'top center', 'bottom center']. Default: top left
inline {bool} If true inline picker displayed. Default: false
closable {bool} If true, popup closes after selecting a month
inlineLabel {bool} A field can have its label next to instead of above it.
closeOnMouseLeave {bool} Should close when cursor leaves calendar popup. Default: true
dateFormat {string} Moment date formatting string. Default: "MMM"
disable {string|Moment|Date|string[]|Moment[]|Date[]} Date or list of dates that are displayed as disabled.
maxDate {string|Moment|Date|string[]|Moment[]|Date[]} Maximum date that can be selected.
minDate {string|Moment|Date|string[]|Moment[]|Date[]} Minimum date that can be selected.
mountNode {any} The node where the picker should mount.
onClear {func} Called after clear icon has clicked.
clearable {boolean} Using the clearable setting will let users remove their selection from a calendar.
clearIcon {any} Optional Icon to display inside the clearable Input.
pickerWidth {string} Optional width value for picker (any string value that could be assigned to style.width).
pickerStyle {object} Optional style object for picker.
duration {number} Optional duration of the CSS transition animation in milliseconds. Default: 200
animation {string} Optional named animation event to used. Must be defined in CSS. Default: 'scale'
localization {string} Sets Moment date locale locally for this component.
icon {string|false} icon to display inside Input.
iconPosition {'left'|'right'} icon position inside Input. Default: 'right'.
hideMobileKeyboard {bool} Try to prevent mobile keyboard appearing.

MonthRangeInput

Prop Description
all that can be used with SUIR Form.Input
value {string} Currently selected value; must have format dateFormat.
popupPosition {string} One of ['top left', 'top right', 'bottom left', 'bottom right', 'right center', 'left center', 'top center', 'bottom center']. Default: top left
inline {bool} If true inline picker displayed. Default: false
closable {bool} If true, popup closes after selecting a month
inlineLabel {bool} A field can have its label next to instead of above it.
closeOnMouseLeave {bool} Should close when cursor leaves calendar popup. Default: true
dateFormat {string} Moment date formatting string. Default: "MMM"
maxDate {string|Moment|Date|string[]|Moment[]|Date[]} Maximum date that can be selected.
minDate {string|Moment|Date|string[]|Moment[]|Date[]} Minimum date that can be selected.
mountNode {any} The node where the picker should mount.
onClear {func} Called after clear icon has clicked.
clearable {boolean} Using the clearable setting will let users remove their selection from a calendar.
clearIcon {any} Optional Icon to display inside the clearable Input.
pickerWidth {string} Optional width value for picker (any string value that could be assigned to style.width).
pickerStyle {object} Optional style object for picker.
duration {number} Optional duration of the CSS transition animation in milliseconds. Default: 200
animation {string} Optional named animation event to used. Must be defined in CSS. Default: 'scale'
localization {string} Sets Moment date locale locally for this component.
icon {string|false} icon to display inside Input.
iconPosition {'left'|'right'} icon position inside Input. Default: 'right'.
hideMobileKeyboard {bool} Try to prevent mobile keyboard appearing.
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].