Porsche Design SystemSearchNavigate to GitHub repository of Porsche Design SystemOpen sidebar
ConfiguratorExamplesUsageAccessibilityAPI
Input Date Table of Contents Form The p-input-date component is a form-associated custom element that integrates seamlessly with forms. Leveraging the ElementInternals API, it functions like a native input, ensuring compatibility with form behaviors. However, note that browser support for this API is limited.
SubmitReset
Last submitted data:
Open in Stackblitz
<!doctype html>
<html lang="en" class="auto">
<head>
  <title></title>
</head>
<body class="bg-base">

<form>
  <p-input-date name="some-name" label="Some Label"></p-input-date>
  <p-button type="submit">Submit</p-button>
  <p-button type="reset">Reset</p-button>
</form>

<p-text>Last submitted data: </p-text>
<script>
  const debugElement = document.querySelector('p-text');
  const form = document.querySelector('form');
  form.addEventListener('submit', (e) => {
    e.preventDefault();
    const formData = new FormData(form);
    debugElement.innerText = `Last submitted data: ${formData.get('some-name')}`;
  });
</script>
</body>
</html>
Controlled In the controlled approach, the p-input-date value is externally managed. While the internal value will be updated automatically, you can use the input, change or blur event to update the external state.
Value:
Open in Stackblitz
<!doctype html>
<html lang="en" class="auto">
<head>
  <title></title>
</head>
<body class="bg-base">

<p-input-date name="some-name" label="Some Label"></p-input-date>

<p-text>Value: ''</p-text>
<script>
  const debugElement = document.querySelector('p-text');
  const inputNumber = document.querySelector('p-input-date');

  inputNumber.addEventListener('input', (e) => {
    e.target.value = e.detail.target.value;
    setDebugText(e.detail.target.value);
  });

  function setDebugText(value) {
    debugElement.innerText = `Value: ${value}`;
  }
</script>
</body>
</html>
Slots Sometimes it's useful to be able to render markup (e.g. an anchor tag) for label, description or message. Therefore, a named slot can be used. Make sure not to define the corresponding property on the host element when a named slot is used (because a property definition is preferred over a named slot). For named slots only phrasing content is allowed. If you need to provide additional information or actions to the user, you can use the start and end slots. For example, you might include an icon, a unit, or an action button. Icons and text should use the contrast-medium color to avoid being mistaken for a button. If you use a p-button-pure or a p-link-pure, a padding and margin have to be set with the exposed --ref-p-input-slotted-padding and --ref-p-input-slotted-margin CSS Variables.
Some label with a link.Some description with a link.Some error message with a link.
Open in Stackblitz
<!doctype html>
<html lang="en" class="auto">
<head>
  <title></title>
</head>
<body class="bg-base">

<p-input-date state="error">
  <span slot="label" id="some-label-id">
    Some label with a 
    <a href="https://designsystem.porsche.com">
      link
    </a>
    .
  </span>
  <span slot="description" id="some-description-id">
    Some description with a 
    <a href="https://designsystem.porsche.com">
      link
    </a>
    .
  </span>
  <p-icon slot="start" name="shopping-cart" color="contrast-medium" aria-hidden="true"></p-icon>
  <p-button-pure slot="end" icon="delete" hide-label="true" class="p-(--ref-p-input-slotted-padding) m-(--ref-p-input-slotted-margin)" aria="{'aria-label': 'Delete'}"></p-button-pure>
  <span slot="message" id="some-message-id">
    Some error message with a 
    <a href="https://designsystem.porsche.com">
      link
    </a>
    .
  </span>
</p-input-date>
<script>

</script>
</body>
</html>
Global settingsThemeChanges the theme of the application and any Porsche Design System component. It's possible to choose between forced theme light and dark. It's also possible to use auto, which applies light or dark theme depending on the operating system settings automatically.LightDarkAuto (sync with operating system)DirectionThe dir global attribute in HTML changes the direction of text and other content within an element. It's most often used on the <html> tag to set the entire page's direction, which is crucial for supporting languages that are written from right to left (RTL), such as Arabic and Hebrew. For example, using <html dir="rtl"> makes the entire page display from right to left, adjusting the layout and text flow accordingly.LTR (left-to-right)RTL (right-to-left)Text ZoomTo ensure accessibility and comply with WCAG 2.2 AA standards, it is mandatory for web content to support text resizing up to at least 200% without loss of content or functionality. Using relative units like rem is a best practice for achieving this, as they allow the text to scale uniformly based on the user's browser settings.100%130%150%200%