Porsche Design SystemSearchNavigate to GitHub repository of Porsche Design SystemOpen sidebar
ConfiguratorExamplesUsageAccessibilityAPI
Text Field Wrapper Table of Contents Counter If the maxlength attribute is present on the input element, a counter will be displayed in the corner. To hide it you can set showCounter to false. The showCharacterCount property has been deprecated and will be removed with the next major release.
Please use the showCounter property instead.
Open in Stackblitz
<!doctype html>
<html lang="en" class="auto">
<head>
  <title></title>
</head>
<body class="bg-base">

<p-text-field-wrapper label="Some label">
  <input type="text" name="some-name" value="Some value" maxlength="20" />
</p-text-field-wrapper>

<p-text-field-wrapper label="Some label" show-counter="false">
  <input type="text" name="some-name" value="Some value" maxlength="20" />
</p-text-field-wrapper>
<script>

</script>
</body>
</html>
type="number" Inputs with type="number" can display a unit (e.g. €, EUR, km/h, etc.) with a maximum of five characters. A description of the used unit should be provided to ensure accessibility.
Open in Stackblitz
<!doctype html>
<html lang="en" class="auto">
<head>
  <title></title>
</head>
<body class="bg-base">

<p-text-field-wrapper label="Some label" description="The price in Euro" unit="EUR" unit-position="prefix">
  <input type="number" name="some-name" value="500" />
</p-text-field-wrapper>
<script>

</script>
</body>
</html>
type="password" Inputs with type="password" receive a toggle button to display the input's value in clear text.
Open in Stackblitz
<!doctype html>
<html lang="en" class="auto">
<head>
  <title></title>
</head>
<body class="bg-base">

<p-text-field-wrapper label="Some label">
  <input type="password" name="some-name" value="some password" />
</p-text-field-wrapper>
<script>

</script>
</body>
</html>
type="password" without password toggle button If you want to remove the password toggle button, you can pass showPasswordToggle="false". The showPasswordToggle prop is experimental and might be removed in a future release.
Open in Stackblitz
<!doctype html>
<html lang="en" class="auto">
<head>
  <title></title>
</head>
<body class="bg-base">

<p-text-field-wrapper label="Some label" show-password-toggle="false">
  <input type="password" name="some-name" value="some password" />
</p-text-field-wrapper>
<script>

</script>
</body>
</html>
type="search" Inputs with type="search" receive a decorative search icon when used outside a form. Only if used inside a form, a submit button becomes visible which can be hidden using submitButton="false". If the input contains a value, a clear button shows up.
Open in Stackblitz
<!doctype html>
<html lang="en" class="auto">
<head>
  <title></title>
</head>
<body class="bg-base">

<p-text-field-wrapper label="Some label">
  <input type="search" name="some-name" />
</p-text-field-wrapper>

<form>
  <p-text-field-wrapper label="Some label" submit-button="true">
    <input type="search" name="some-name" />
  </p-text-field-wrapper>
</form>
<script>

</script>
</body>
</html>
type="search" with locate action Inputs with type="search" that also have the actionIcon="locate" property always show an action button, no matter if used within or outside a form.
Open in Stackblitz
<!doctype html>
<html lang="en" class="auto">
<head>
  <title></title>
</head>
<body class="bg-base">

<p-text-field-wrapper label="Some label" action-icon="locate">
  <input type="search" name="some-name" />
</p-text-field-wrapper>

<form>
  <p-text-field-wrapper label="Some label" action-icon="locate">
    <input type="search" name="some-name" />
  </p-text-field-wrapper>
</form>
<script>

</script>
</body>
</html>
type="search" with locate action and loading On top of actionIcon="locate" it is possible to put the component into a loading state via actionLoading="true".
Open in Stackblitz
<!doctype html>
<html lang="en" class="auto">
<head>
  <title></title>
</head>
<body class="bg-base">

<p-text-field-wrapper label="Some label" action-icon="locate" action-loading="true">
  <input type="search" name="some-name" />
</p-text-field-wrapper>

<form>
  <p-text-field-wrapper label="Some label" action-icon="locate" action-loading="true">
    <input type="search" name="some-name" />
  </p-text-field-wrapper>
</form>
<script>

</script>
</body>
</html>
Demo implementation
Value:
Open in Stackblitz
<!doctype html>
<html lang="en" class="auto">
<head>
  <title></title>
</head>
<body class="bg-base">

<p-text-field-wrapper label="Search location" hide-label="true" action-icon="locate">
  <input type="search" />
</p-text-field-wrapper>
<p-text>Value: </p-text>
<script>
  const textFieldWrapper = document.querySelector('p-text-field-wrapper');
  const input = document.querySelector('input');
  const text = document.querySelector('p-text');

  const setInputPlaceholder = (active) => (input.placeholder = active ? 'Locating...' : '');

  textFieldWrapper.addEventListener('action', (e) => {
    e.target.actionLoading = true;
    setInputPlaceholder(true);

    // simulate async request
    setTimeout(() => {
      input.value = 'Stuttgart, Baden-Württemberg';
      text.innerText = 'Value: ' + input.value;
      e.target.actionLoading = false;
      setInputPlaceholder(false);
    }, 3000);
  });

  input.addEventListener('input', (e) => {
    text.innerText = 'Value: ' + e.target.value;
    if (textFieldWrapper.actionLoading) {
      textFieldWrapper.actionLoading = false;
      setInputPlaceholder(false);
    }
  });
</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.
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-text-field-wrapper 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>
  <input type="text" name="some-name" aria-labelledby="some-label-id" aria-describedby="some-description-id some-message-id" />
  <span slot="message" id="some-message-id">
    Some error message with a 
    <a href="https://designsystem.porsche.com">
      link
    </a>
    .
  </span>
</p-text-field-wrapper>
<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)DirectionChanges the direction of HTML elements, mostly used on<html> tag to support languages which are read from right to left like e.g. Arabic.LTR (left-to-right)RTL (right-to-left)AutoText ZoomChanges the text size and values with unit rem or em relatively. This setting can be defined in browser settings for any website or by an application itself on<html> tag. To achieve WCAG 2.2 AA compliance it's obligatory to support text zoom up to at least 200%.100%130%150%200%