0.0.1-beta.2 • Published 1 year ago

mds-input v0.0.1-beta.2

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

mds-input - Lit version

Install

Install the component via npm

npm install mds-input

Or use yarn

yarn add mds-input

Use in JavaScript

Import the component in your project

<script type="module">
  import 'mds-input';
</script>

His dependencies

<script type="module">
  import { defineCustomElements } from '@maggioli-design-system/mds-text/loader';
  defineCustomElements();
</script>

Maggioli Design System style in the head tag

<link rel="stylesheet" href="./node_modules/@maggioli-design-system/styles/dist/css/colors-rgb.css">

The use it in your HTML

<mds-input type="text" placeholder="Write something"></mds-input>

Properties

PropertyAttributeDescriptionTypeDefault
autocompleteautocompleteSpecifies whether the element should have autocomplete enabled"address" \| "name" \| "url" \| "email" \| "off" \| "on" \| "additional-name" \| "address-level1" \| "address-level2" \| "address-level3" \| "address-level4" \| "address-line1" \| "address-line2" \| "address-line3" \| "bday" \| "bday-day" \| "bday-month" \| "bday-year" \| "cc-additional-name" \| "cc-csc" \| "cc-exp" \| "cc-exp-month" \| "cc-exp-year" \| "cc-family-name" \| "cc-given-name" \| "cc-name" \| "cc-number" \| "cc-type" \| "country" \| "country-name" \| "current-password" \| "family-name" \| "given-name" \| "honorific-prefix" \| "honorific-suffix" \| "impp" \| "language" \| "new-password" \| "nickname" \| "one-time-code" \| "organization" \| "organization-title" \| "photo" \| "postal-code" \| "sex" \| "street-address" \| "tel" \| "tel-area-code" \| "tel-country-code" \| "tel-extension" \| "tel-local" \| "tel-national" \| "transaction-amount" \| "transaction-currency" \| "username"'off'
autofocusautofocusSpecifies that the element should automatically get focus when the page loadsbooleanfalse
datalist--A list of search terms to be searched from the input field, it should be used with type="search" input.string[]undefined
disableddisabledIf true, the element is displayed as disabledbooleanfalse
iconiconAn icon displayed at the right of the inputstringundefined
maxmaxSpecifies the maximum value use it with input type="number" or type="date" Example: max="180", max="2046-12-04"numberundefined
maxlengthmaxlengthSpecifies the maximum number of characters allowed in an element use it with input type="number"numberundefined
minminSpecifies the minimum value use it with input type="number" or type="date" Example: min="-3", min="1988-04-15"stringundefined
minlengthminlengthSpecifies the minimum number of characters allowed in an element use it with input type="number"numberundefined
namenameIs needed to reference the form data after the form is submittedstringundefined
patternpatternSpecifies a regular expression that element\'s value is checked againststringundefined
placeholderplaceholderSpecifies a short hint that describes the expected value of the elementstringundefined
readonlyreadonlySpecifies that the element is read-onlybooleanfalse
requiredrequiredSpecifies that the element must be filled out before submitting the formbooleanfalse
stepstepSpecifies the interval between legal numbers in an input fieldstringundefined
typetypeSpecifies the type of input element"date" \| "email" \| "number" \| "password" \| "search" \| "tel" \| "text" \| "textarea" \| "time" \| "url"'text'
valuevalueSpecifies the value of the input elementnumber \| string''
variantvariantSets the variant of the input field"error" \| "info" \| "success" \| "warning"undefined
variantTipvariant-tipSets the word(s) of the variant of the input fieldstringundefined

Events

EventDescriptionType
blurEventEmits a void event when input element is blurredCustomEvent<void>
changeEventEmits an InputChangeEventDetail when the value of the input element changesCustomEvent<InputValue>
focusEventEmits a void event when input element is focusedCustomEvent<void>
inputEventEmits a KeyboardEvent when a keboard key is pressed on the focused input elementCustomEvent<InputEvent>

Form support for Safari

To be able to use the form component in Safari, you will need to include this polyfill in your application's dependencies and add it in your main TypeScript file:

import 'element-internals-polyfill'

or in your main HTML file like:

<script type="module">
  import 'element-internals-polyfill'
</script>

Built with lit and vite