Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ak-calendar

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ak-calendar

A React component that is a generic calendar

  • 2.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

AtlasKit component registry Commitizen friendly semantic-release Report an issue Ask in our forum

Calendar

The ak-calendar component is a generic calendar that can be used standalone or together with a form field to make a datepicker.

Example buttons

Try it out

Interact with a live demo of the ak-calendar component with code examples.

Installation

npm install ak-calendar

Using the component

HTML

The ak-calendar package exports the a web component.

Import the component in your JS resource:

bundle.js
import 'ak-calendar';

Now you can use the defined tag in your HTML markup:

index.html
<html>
  <head>
    <script src="bundle.js"></script>
  </head>
  <body>
    <!-- ... -->
    <ak-calendar></ak-calendar>
  </body>
</html>

You can also use it from within another JavaScript resource:

import Calendar from 'ak-calendar';

const component = new Calendar();
document.body.appendChild(component);

React

This is a standard web component, if you want to use it in your React app, use the Skate.js React integration.

import Calendar from 'ak-calendar';
import reactify from 'skatejs-react-integration';

const ReactComponent = reactify(Calendar, {});

ReactDOM.render(<ReactComponent />, container);
Setting props

When using it as a react component, you should set the camelCased version of the HTML attribute:

HTML:

<ak-calendar some-prop="something" />

React JSX:

<ReactComponent someProp="something" />

API

As with all web components, the calendar is given safe defaults and no parameters are required.

Any prop that takes multiple dates will expect the dates in yyyy-mm-dd without leading zeroes. Any prop that takes more than one date can be specified as an attribute as an array.

disabled

Applies the disabled styles to the specified dates.

Default: [].

This doesn't not prevent the select event from being emitted.

<ak-calendar disabled="['1906-4-18', '1908-10-17']" />

focused

A single number that tells the calendar which day is focused. If a screen reader is turned on, this will announce the date that is currently focused. It also applies the correct styles to indicate visually to the user which day is selected. If no focus should be applied, this should be 0.

Default: 0

<ak-calendar focused="29" />

month

Tells the calendar which month to display. The number is specified as the month number, not index. This is divergent to the JavaScript Date()` constructor which has 0-indexed months, but standard 1-indexed for the rest. This is to make the entire API consistent and intuitive.

Default: current month.

<!-- December -->
<ak-calendar month="12" />

previouslySelected

Tells the calendar which dates were last selected. This visually indicates to the user which dates were selected, but doesn't offer any additional behaviour.

Default: [].

<ak-calendar previously-selected="['1906-4-18', '1908-10-17']" />

selected

The dates that should be selected.

Default: [].

<ak-calendar selected="['1906-4-18', '1908-10-17']" />

year

Tells the calendar which month to display.

Default: current year.

<!-- Displays the current month in 1984 -->
<ak-calendar year="1984" />

Support and feedback

We're here to help!

Let us know what you think of our components and docs, your feedback is really important for us.

Community support

Ask a question in our forum.

Check if someone has already asked the same question before.

Create a support ticket

Are you in trouble? Let us know!

FAQs

Package last updated on 03 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc