
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@spectrum-web-components/help-text
Advanced tools
Web component implementation of a Spectrum design HelpText
An <sp-help-text>
provides either an informative description or an error message that gives more context about what a user needs to input. It's commonly used in forms.
yarn add @spectrum-web-components/help-text
Import the side effectful registration of <sp-help-text>
via:
import '@spectrum-web-components/help-text/sp-help-text.js';
When looking to leverage the HelpText
base class as a type and/or for extension purposes, do so via:
import { HelpText } from '@spectrum-web-components/help-text';
<sp-field-label size="s" for="size-s">Password</sp-field-label>
<sp-textfield size="s" id="size-s" type="password">
<sp-help-text size="s" slot="help-text">
Create a password with at least 8 characters.
</sp-help-text>
</sp-textfield>
Medium
<sp-field-label size="m" for="size-m">Password</sp-field-label>
<sp-textfield size="m" id="size-m" type="password">
<sp-help-text size="m" slot="help-text">
Create a password with at least 8 characters.
</sp-help-text>
</sp-textfield>
Large
<sp-field-label size="l" for="size-l">Password</sp-field-label>
<sp-textfield size="l" id="size-l" type="password">
<sp-help-text size="l" slot="help-text">
Create a password with at least 8 characters.
</sp-help-text>
</sp-textfield>
Extra Large
<sp-field-label size="xl" for="size-xl">Password</sp-field-label>
<sp-textfield size="xl" id="size-xl" type="password">
<sp-help-text size="xl" slot="help-text">
Create a password with at least 8 characters.
</sp-help-text>
</sp-textfield>
The negative variant of <sp-help-text>
is used to convey error messages.
Help text displays either a description (the neutral variant) or an error message (the negative variant) in the same space. When a description is present and an error is triggered, it is replaced with an error message. Once the error is resolved, the help text description reappears.
Since one gets replaced by the other, the language of the help text description and the error need to work together to convey the same messaging. The description text explains the requirements or adds supplementary context for how to successfully interact with a component. The error message text tells a user how to fix the error by re-stating the interaction requirements. Make sure that the help text description and error message include the same essential information so that it isn’t lost if one replaces the other.
Communicate error messages in a human-centered way by guiding a user and showing them a solution — don’t simply state what’s wrong and then leave them guessing as to how to resolve it. Ambiguous error messages can be frustrating and even shame-inducing for users. Also, keep in mind that something that a system may deem an error may not actually be perceived as an error to a user.
For help text, usually the error is related to something that needs to be fixed for in-line validation, so a helpful tone is most appropriate. For example, if someone were to miss filling out a required field that asks for their email address, write the error text like you’re offering a hint or a tip to help guide them to understand what needs to go in the missing field: “Enter your email address.”
<sp-field-label for="negative">Password</sp-field-label>
<sp-textfield id="negative" type="password" required invalid>
<sp-help-text slot="help-text">
Create a password with at least 8 characters.
</sp-help-text>
<sp-help-text variant="negative" slot="help-text-negative">
Passwords must be at least 8 characters
</sp-help-text>
</sp-textfield>
When associated with content that does not supply an icon outlining the presence of an error, use the icon
attribute to display one as part of the <sp-help-text>
element.
<sp-field-group horizontal id="fruit">
<sp-checkbox value="apple">Apple</sp-checkbox>
<sp-checkbox
value="not-a-fruit"
onchange="javascript:this.parentElement.invalid = this.checked"
>
Lettuce
</sp-checkbox>
<sp-checkbox value="strawberry" checked>Strawberry</sp-checkbox>
<sp-help-text slot="help-text">One of these is not a fruit.</sp-help-text>
<sp-help-text icon slot="negative-help-text" icon>
Choose actual fruit(s).
</sp-help-text>
</sp-field-group>
When the content associated to the element is disabled, use the disabled
attribute to match the delivery of the <sp-help-text>
element to that content.
<sp-field-label for="color" disabled>Color</sp-field-label>
<sp-combobox id="color" disabled>
<sp-menu-item value="red">Red</sp-menu-item>
<sp-menu-item value="green">Green</sp-menu-item>
<sp-menu-item value="blue">Blue</sp-menu-item>
<sp-help-text slot="help-text" disabled>
Choose or add at least one color.
</sp-help-text>
</sp-combobox>
Good, descriptive help text includes 1-2 short sentences of information such as:
It is not currently possible to provide accessible ARIA references between elements in different shadow roots. To ensure proper association between elements, help text must be included via the slot="help-text"
or slot="help-text-negative"
in an <sp-text-field>
, <sp-field-group>
, <sp-combobox>
or <sp-picker>
.
To add help text to your own custom element, see Help Text Mixin.
1.8.0 (2025-09-23)
sp-picker: Fixed escape key behavior in modal overlays containing picker components. Previously, pressing the Escape key when a picker was open inside a modal overlay would not properly close the modal, instead moving focus to the picker. Now, the escape key correctly closes the picker first (if open), then closes the modal overlay on subsequent escape key presses.
This fix adds a check for this.open
in the picker's handleEscape
method to ensure proper modal overlay closure behavior.
sp-overlay: Added allow-outside-click
property to <sp-overlay>
with deprecation notice. This property allows clicks outside the overlay to close it, but is not recommended for accessibility reasons and will be removed in a future version.
This property is being added as deprecated to support the fallback for showModal()
which was removed as part of performance optimization. We will no longer support outside clicks for modal overlays as they violate accessibility guidelines.
The property defaults to false
and shows deprecation warnings when used. Consider using explicit close buttons or modal/page overlay types instead for better accessibility.
sp-menu: Fixed : Fix iPad scrolling issue in picker dropdown where scrolling through menu items would accidentally select the first touched item and close the picker.
The fix implements touch gesture detection to distinguish between scrolling and selection. Added isScrolling
getter for public API access. Test on iPad devices with long menus to validate scrolling behavior and selection accuracy.
sp-overlay: Fixed : Added body scroll prevention for modal and page overlays. Overlay automatically blocks body scroll when modal or page overlays are open and restores the original scroll state when they are closed, improving user experience and accessibility for modal dialogs.
sp-clear-button: Clear button styles have been updated to the latest Spectrum CSS version of the clear button. This update includes a major reduction in the number of custom property abstractions needed to support the multiple theming layers (as seen in the styles
package).
This update spans the following additional packages:
As the updated styles now offer additional styling options, we have added the following API to the clear button component that exists in the button
package:
quiet
- when set to true, the button will be rendered as a quiet button. This is useful for cases where you want to use the clear button in a more subtle way.disabled
- when set to true, the button will be rendered as a disabled button.static-color
- currently this only supports the white
context color. This is useful for cases where the button appears on a dark background texture. This is a replacement for the previously used variant="overBackground"
attribute which is deprecated.The variant="overBackground"
attribute is deprecated; please use the new static-color="white"
attribute instead. When this property is used in the component, a deprecation warning will be shown in the console when in debug mode. The variant
attribute will be removed in a future release.
sp-card: Fixed the card component's CSS by moving block-size: 100%
from the base :host
selector to only apply to gallery
and quiet
variants
sp-overlay: Fixed : external click registration behavior in the sp-overlay
component. Programmatic clicks on elements outside of modal overlays now properly register and close the overlay, while user-initiated clicks are prevented from doing so.
sp-card: Enhanced the Card component's checkbox functionality with improved screen reader support and keyboard navigation.
sp-progress-bar: Added: Deprecation warning for the over-background attribute.
sp-combobox: Replace the use of offsetWidth with a resizeObserver to avoid unecessary, performance-impacting layout reflows.
sp-styles: Bring the CJK font alias token fix from CSS #3883 4e3a120
.
The --spectrum-cjk-font
token was incorrectly mapped to the code font-family stack instead of --spectrum-cjk-font-family-stack
. Thanks @byteakp!
sp-color-wheel: Fixed <sp-color-wheel>
step attribute functionality for keyboard navigation. The step attribute now properly controls the increment size when using arrow keys to navigate the color wheel.
sp-switch: ### Fix down state colors for switch
Because the postcss-hover-media-feature
plugin converts hover styles into a media query for devices that support hover, the hover styles were overriding any active/down state styles. We needed to target the active/down states of the switch with additional active state selectors, in order to ensure that the active state takes precedence over the hover state, maintaining the correct visual behavior of the switch component across different interaction states.
This fix should address hover + active state discrepancies in S1 and S2 foundations.
sp-contextual-help: Fixed a typo in the default info
variant label from "Informations" to "Information".
Additionally, added package dependency for @spectrum-web-components/reactive-controllers@1.7.0
.
sp-slider: Editable sliders will now reliably emit input
events when interaction starts with the track.
sp-link: Fixed quiet variant links not showing keyboard focus state in Safari. Links with the quiet
attribute now properly display focus indicators when navigating with keyboard, improving accessibility for keyboard users.
sp-progress-bar: Smooths the transition animation of indeterminate progress bar by overriding the incoming CSS, and positioning the animating fill element completely off of the progress bar track in both LTR and RTL languages. Before, the fill element was automatically starting on the track which led to a jarring animation loop.
sp-divider: Added: staticColor
property to the Divider component, enabling programmatic control of the existing static color functionality.
FAQs
Web component implementation of a Spectrum design HelpText
The npm package @spectrum-web-components/help-text receives a total of 3,534 weekly downloads. As such, @spectrum-web-components/help-text popularity was classified as popular.
We found that @spectrum-web-components/help-text demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.