p-select
component is a versatile custom form element that enables the selection of a single options. It can be
used p-select
component is used within a form, it utilizes the
ElementInternals API, which has limited
browser support. For broader browser compatibility, consider using a
controlled approach instead.label
, description
, state
, message
, hideLabel
, disabled
, required
&
dropdownDirection
).p-select-option
component. Each option needs to have an assigned value, which can be
passed via an attribute or property and needs to be of type string. Initial selection states can only be achieved using
the value property on the p-select
component (disabled
attribute. If the selection isn't required or should be clearable again, you can use an empty
p-select-option
as default selection (p-select
utilizes the #top-layer
which enables it to be shown correctly even when used e.g. within a scroll container.Some description
<!doctype html>
<html lang="en" class="auto">
<head>
<title></title>
</head>
<body class="bg-base">
<p-select name="options" label="Some Label" description="Some description">
<p-select-option value="a">
Option A
</p-select-option>
<p-select-option value="b">
Option B
</p-select-option>
<p-select-option value="c">
Option C
</p-select-option>
<p-select-option value="d">
Option D
</p-select-option>
<p-select-option value="e">
Option E
</p-select-option>
<p-select-option value="f">
Option F
</p-select-option>
</p-select>
<script>
</script>
</body>
</html>