Edit in GitHubLog an issue

sp-textarea

Since: UXP v4.1

Renders a text area with optional associated label.

Text areas

See:

Example

Copied to your clipboard
<sp-textarea placeholder="Enter your name">
<sp-label slot="label">Name</sp-label>
</sp-textarea>

Variants and states

There are several different variants for text areas.

Disabled

Indicates that the text area is disabled.

Copied to your clipboard
<sp-textarea disabled placeholder="Enter your name"></sp-textarea>

Valid

Indicates that the value of the text area is valid.

Copied to your clipboard
<sp-textarea valid placeholder="Enter your name"></sp-textarea>

Invalid

Indicates that the value of the text area is invalid.

Copied to your clipboard
<sp-textarea invalid placeholder="Enter your name"></sp-textarea>

Quiet

Styles the text area in a quieter, simpler appearance.

Copied to your clipboard
<sp-textarea quiet placeholder="Enter your name"></sp-textarea>

Responding to events

You can respond to changes on the text area using the change and input events.

Copied to your clipboard
document.querySelector(".yourTextArea").addEventListener("input", evt => {
console.log(`New value: ${evt.target.value}`);
})
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.