Input

Input component is a form element that allows the user to input data. It can be used in various forms such as text, email, etc. Altough we have separate components for the number and the password input, the input component can be used for the rest of the types.

Design system docs

Examples Default Input
<dap-ds-input
    label="Name"
    placeholder="Enter your name"
  ></dap-ds-input>
Description

Description can be added to the input field to provide additional information to the user.

<dap-ds-input
    label="Name"
    placeholder="Enter your name"
    description="Please enter your full name"
  ></dap-ds-input>
Feedback message

Feedback message can be added to the input field to provide feedback to the user. Feedback messages can be of two types: error and success and they are handled by the feedbackType attribute.

<dap-ds-stack direction="column">
    <dap-ds-input
      label="Name"
      placeholder="Enter your name"
      required
      feedback="Please enter your full name"
      feedbackType="negative"
    ></dap-ds-input>

    <dap-ds-input
      label="Name"
      placeholder="Enter your name"
      feedback="Your username is available"
      feedbackType="positive"
    ></dap-ds-input>
  </dap-ds-stack>
Sizes

Input field can have different sizes. The default size is small.

<dap-ds-stack direction="column">
    <dap-ds-input
      label="Small / Sm"
      placeholder="Enter your name"
    ></dap-ds-input>

    <dap-ds-input
      label="Large/ Lg"
      placeholder="Enter your name"
      size="lg"
    ></dap-ds-input>
  </dap-ds-stack>
Statuses

Input field can have different statuses.

<dap-ds-stack direction="column">

    <dap-ds-input
      label="Loading"
      loading
      placeholder="Enter your name"
    ></dap-ds-input>
  
    <dap-ds-input
      label="Success"
      placeholder="Enter your name"
      status="success"
      feedback="Your username is available"
      feedbackType="positive"
    ></dap-ds-input>

    <dap-ds-input
      label="Error"
      placeholder="Enter your name"
      status="error"
      required
      feedback="Please enter your full name"
      feedbackType="negative"
    ></dap-ds-input>

    <dap-ds-input
      label="Disabled"
      placeholder="Enter your name"
      disabled
    ></dap-ds-input>

    <dap-ds-input
      label="Readonly"
      value="John Doe"
      placeholder="Enter your name"
      readonly
    ></dap-ds-input>
  </dap-ds-stack>
Importing
import { DapDSInput } from 'dap-design-system/dist/dds'
Importing React
import { DapDSInputReact } from 'dap-design-system/dist/react'
Slots
NameDescription
postfixThe postfix of the input.
prefixThe prefix of the input.
addon-beforeThe addon before the input.
addon-afterThe addon after the input.
feedback-iconThe custom icon of the feedback.
Attributes
PropertyTypeDefaultDescription
labelstringThe label of the input.
optionalLabelstringText of optional label.
subtlebooleanText weight of label. If true the label is subtle. Default value is false.
placeholderstringThe placeholder of the input.
descriptionstringThe description of the input.
tooltipstringThe tooltip of the input.
statusstringThe status of the input. Can be success or error.
size'sm' 'lg'The size of the input. Default is sm. Can be sm or lg.
namestringThe name of the input.
valuestringThe value of the input.
typestringThe type of the input. Default is 'text'.
disabledbooleanThe disabled state of the input. Default is false.
requiredbooleanThe required state of the input. Default is false.
readonlybooleanThe readonly state of the input. Default is false.
autofocusbooleanThe autofocus state of the input. Default is false.
autocapitalizebooleanThe autocapitalize state of the input. Default is false.
minlengthnumberThe minimum length of the input.
maxlengthnumberThe maximum length of the input.
minnumberThe minimum value of the number input.
maxnumberThe maximum value of the number input.
stepnumberThe step value of the number input.
inputmodestringThe inputmode of the input.
patternstringThe regex pattern of the input.
feedbackstringThe feedback of the input.
feedbackType'info' 'success' 'error'The feedback type of the input. Can be info, success, or error.
loadingbooleanThe loading state of the input. Default is false.
Events
Event NameDescription
dds-changeFired when the input value changes.
dds-inputFired when the input value changes.
dds-keydownFired when a key is pressed down.
dds-blurFired when the input loses focus.
dds-focusEmitted when the input gains focus.
CSS Parts
Part NameDescription
baseThe main input container.
inputThe input element.
labelThe label of the input.
descriptionThe description of the input.
feedbackThe feedback of the input.
tooltipThe tooltip of the input.
addon-beforeThe addon before the input.
addon-afterThe addon after the input.
prefixThe prefix of the input.
postfixThe postfix of the input.