Skip to content

Documentation / @jalali-js/web

@jalali-js/web ​

npm versionLicense: MITDocs

Framework-free Web Components for jalali-js: headless calendar and styled date/time pickers. Use them from plain HTML, or drop them into any host framework.

Start here: Live demo · Documentation

npm ecosystem: jalali-js · @jalali-js/i18n · @jalali-js/nlp · @jalali-js/holidays · @jalali-js/react · @jalali-js/vue · @jalali-js/web · @jalali-js/ui-react · @jalali-js/ui-vue · @jalali-js/ui-web

Contents ​

Install ​

sh
npm install @jalali-js/web
ts
import '@jalali-js/web';
import '@jalali-js/web/date-picker.css';

Importing the package registers the custom elements.

Compatibility ​

ItemSupport
RuntimeModern browsers with Custom Elements
PeersNone
Node22 and 24 (CI matrix)
VerifiedChromium, Firefox, WebKit in the e2e matrix

Quick start ​

html
<script type="module">
  import '@jalali-js/web';
  import '@jalali-js/web/date-picker.css';
</script>

<jalali-date-picker
  id="picker"
  system="jalali"
  locale="fa"
  value-format="gregorian-iso"
></jalali-date-picker>

<script type="module">
  document.getElementById('picker').addEventListener('change', (e) => {
    console.log(e.detail.value);
  });
</script>

Elements ​

ElementRole
<jalali-date-picker>Styled picker (grid or dropdown variant)
<jalali-time-picker>Hour and minute selection
<jalali-calendar>Headless calendar primitive

Range, event, and time-range elements ship in @jalali-js/ui-web.

Attributes use kebab-case (value-format, minute-step). Properties use camelCase in JS. change events carry { value, date } (or the matching payload for time).

Options ​

Key <jalali-date-picker> attributes:

AttributeValuesDefaultNotes
systemjalali / gregorianjalaliDisplay calendar
localeen / fa / psenUI language
value-formatgregorian-iso / …gregorian-isoStored value shape
variantgrid / dropdowngridPopover or Y/M/D selects
precisiondate / datetimedateAdd a time panel
show-holidaysboolean attributeoffNeeds holidays package

Full tables: Web Components guide.

Theming ​

css
[data-jalali-datepicker-root] {
  --jalali-primary: #2563eb;
  --jalali-radius: 8px;
  --jalali-bg: #ffffff;
  --jalali-fg: #1a1a1a;
}

See Theming.

License ​

MIT

Classes ​

Interfaces ​

Type Aliases ​

Functions ​