Socket
Book a DemoInstallSign in
Socket

@mutt/widget-age

Package Overview
Dependencies
Maintainers
13
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mutt/widget-age

Mutt Forms Widget - Age input

2.1.2
latest
Source
npmnpm
Version published
Weekly downloads
8
Maintainers
13
Weekly downloads
 
Created
Source

Mutt Forms Widget - Age

Mutt Form Vue widget to capture an age in years & months

Requirements

Please ensure you install the peer dependencies which are defined in package.json.

Select dropdown styling

This widget makes use of the vue-select component.

No styling is included for this component, you will need to include it by either including the CSS from the component:

import 'vue-select/dist/vue-select.css';

or importing the SCSS:

@import "vue-select/src/scss/vue-select.scss";

More details on styling the dropdown can be found in the documentation for vue-select.

Field Options

The age widget accepts the following options:

optiontypedescriptiondefault
minISO-8601 formatted StringThe minimum date allowednull
maxISO-8601 formatted StringThe maximum date allowednull
defaultDate or StringThe default date to setnull
dateFieldSeparatorStringA character or string of characters that adds a span containing the character between the date field inputs
attrsObject of Strings or NumbersThe html attributes for the field wrapper e.g data-*null

Please note here that min/max refer to the minimum & maximum dates returned by the widget rather than the age, therefore max should resolve to a later date value than min

Emitted Events

When a valid entry of years & months is entered, the widget will emit the ageValidated event with the following object:

key: this.field.name,
value: this.field.value,
action: 'populated',
validated, // true if the validation rules pass
bubble: true,

Complete Example

dob: {
  help:
    '<p>If you don’t know the exact age, please provide a considered estimate.</p>',
  label: null,
  max: 'P-4W',
  min: 'P-21Y',
  attrs: {
    data-qa-locator: 'pet-info-age-selector'
  },
  natural: {
    prefix: ' and you are ',
    suffix: ' old.',
    title: 'How old are you?',
    trigger: '',
  },
  serialize: 'date',
  widget: 'naturalage',
},

Keywords

mutt-forms

FAQs

Package last updated on 14 Dec 2020

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.