Scriptcomponent
Use the Script
component to add third-party scripts to your app. It automatically adds a nonce attribute from your content security policy. If you load a script that directly modifies the DOM, you are likely to have hydration errors. Use the prop to load the script after the page hydrates.
Anchor to propsProps
HydrogenScriptProps
- Anchor to waitForHydrationwaitForHydrationboolean
Wait to load the script until after the page hydrates. This prevents hydration errors for scripts that modify the DOM. Note: For security,
nonce
is not supported when using. Instead you need to add the domain of the script directly to your Content Securitiy Policy directives.
ScriptAttributes
- Anchor to aboutaboutstring | undefined
- Anchor to accessKeyaccessKeystring | undefined
- Anchor to aria-activedescendantaria-activedescendantstring | undefined
Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application.
- Anchor to aria-atomicaria-atomicBooleanish | undefined
Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.
- Anchor to aria-autocompletearia-autocomplete'none' | 'inline' | 'list' | 'both' | undefined
Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be presented if they are made.
- Anchor to aria-braillelabelaria-braillelabelstring | undefined
Defines a string value that labels the current element, which is intended to be converted into Braille.
- Anchor to aria-brailleroledescriptionaria-brailleroledescriptionstring | undefined
Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille.
- Anchor to aria-busyaria-busyBooleanish | undefined
- Anchor to aria-checkedaria-checkedboolean | 'false' | 'mixed' | 'true' | undefined
Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
- Anchor to aria-colcountaria-colcountnumber | undefined
Defines the total number of columns in a table, grid, or treegrid.
- Anchor to aria-colindexaria-colindexnumber | undefined
Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
- Anchor to aria-colindextextaria-colindextextstring | undefined
Defines a human readable text alternative of aria-colindex.
- Anchor to aria-colspanaria-colspannumber | undefined
Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
- Anchor to aria-controlsaria-controlsstring | undefined
Identifies the element (or elements) whose contents or presence are controlled by the current element.
- Anchor to aria-currentaria-currentboolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time' | undefined
Indicates the element that represents the current item within a container or set of related elements.
- Anchor to aria-describedbyaria-describedbystring | undefined
Identifies the element (or elements) that describes the object.
- Anchor to aria-descriptionaria-descriptionstring | undefined
Defines a string value that describes or annotates the current element.
- Anchor to aria-detailsaria-detailsstring | undefined
Identifies the element that provides a detailed, extended description for the object.
- Anchor to aria-disabledaria-disabledBooleanish | undefined
Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
- Anchor to aria-errormessagearia-errormessagestring | undefined
Identifies the element that provides an error message for the object.
- Anchor to aria-expandedaria-expandedBooleanish | undefined
Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed.
- Anchor to aria-flowtoaria-flowtostring | undefined
Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, allows assistive technology to override the general default of reading in document source order.
- Anchor to aria-haspopuparia-haspopupboolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | undefined
Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.
- Booleanish | undefined
Indicates whether the element is exposed to an accessibility API.
- Anchor to aria-invalidaria-invalidboolean | 'false' | 'true' | 'grammar' | 'spelling' | undefined
Indicates the entered value does not conform to the format expected by the application.
- Anchor to aria-keyshortcutsaria-keyshortcutsstring | undefined
Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.
- Anchor to aria-labelaria-labelstring | undefined
Defines a string value that labels the current element.
- Anchor to aria-labelledbyaria-labelledbystring | undefined
Identifies the element (or elements) that labels the current element.
- Anchor to aria-levelaria-levelnumber | undefined
Defines the hierarchical level of an element within a structure.
- Anchor to aria-livearia-live'off' | 'assertive' | 'polite' | undefined
Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region.
- Anchor to aria-modalaria-modalBooleanish | undefined
Indicates whether an element is modal when displayed.
- Anchor to aria-multilinearia-multilineBooleanish | undefined
Indicates whether a text box accepts multiple lines of input or only a single line.
- Anchor to aria-multiselectablearia-multiselectableBooleanish | undefined
Indicates that the user may select more than one item from the current selectable descendants.
- Anchor to aria-orientationaria-orientation'horizontal' | 'vertical' | undefined
Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.
- Anchor to aria-ownsaria-ownsstring | undefined
Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship between DOM elements where the DOM hierarchy cannot be used to represent the relationship.
- Anchor to aria-placeholderaria-placeholderstring | undefined
Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format.
- Anchor to aria-posinsetaria-posinsetnumber | undefined
Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
- Anchor to aria-pressedaria-pressedboolean | 'false' | 'mixed' | 'true' | undefined
Indicates the current "pressed" state of toggle buttons.
- Anchor to aria-readonlyaria-readonlyBooleanish | undefined
Indicates that the element is not editable, but is otherwise operable.
- Anchor to aria-relevantaria-relevant'additions' | 'additions removals' | 'additions text' | 'all' | 'removals' | 'removals additions' | 'removals text' | 'text' | 'text additions' | 'text removals' | undefined
Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
- Anchor to aria-requiredaria-requiredBooleanish | undefined
Indicates that user input is required on the element before a form may be submitted.
- Anchor to aria-roledescriptionaria-roledescriptionstring | undefined
Defines a human-readable, author-localized description for the role of an element.
- Anchor to aria-rowcountaria-rowcountnumber | undefined
Defines the total number of rows in a table, grid, or treegrid.
- Anchor to aria-rowindexaria-rowindexnumber | undefined
Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
- Anchor to aria-rowindextextaria-rowindextextstring | undefined
Defines a human readable text alternative of aria-rowindex.
- Anchor to aria-rowspanaria-rowspannumber | undefined
Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
- Anchor to aria-selectedaria-selectedBooleanish | undefined
Indicates the current "selected" state of various widgets.
- Anchor to aria-setsizearia-setsizenumber | undefined
Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
- Anchor to aria-sortaria-sort'none' | 'ascending' | 'descending' | 'other' | undefined
Indicates if items in a table or grid are sorted in ascending or descending order.
- Anchor to aria-valuemaxaria-valuemaxnumber | undefined
Defines the maximum allowed value for a range widget.
- Anchor to aria-valueminaria-valueminnumber | undefined
Defines the minimum allowed value for a range widget.
- Anchor to aria-valuenowaria-valuenownumber | undefined
Defines the current value for a range widget.
- Anchor to aria-valuetextaria-valuetextstring | undefined
Defines the human readable text alternative of aria-valuenow for a range widget.
- Anchor to asyncasyncboolean | undefined
- Anchor to autoCapitalizeautoCapitalizestring | undefined
- Anchor to autoCorrectautoCorrectstring | undefined
- Anchor to autoFocusautoFocusboolean | undefined
- Anchor to autoSaveautoSavestring | undefined
- Anchor to childrenchildrenReactNode | undefined
- Anchor to classNameclassNamestring | undefined
- Anchor to colorcolorstring | undefined
- Anchor to contentcontentstring | undefined
- Anchor to contentEditablecontentEditableBooleanish | "inherit" | undefined
- string | undefined
- Anchor to crossOrigincrossOriginCrossOrigin
- Anchor to dangerouslySetInnerHTMLdangerouslySetInnerHTML{ // Should be InnerHTML['innerHTML']. // But unfortunately we're mixing renderer-specific type declarations. __html: string | TrustedHTML; } | undefined
- Anchor to datatypedatatypestring | undefined
- Anchor to defaultCheckeddefaultCheckedboolean | undefined
- Anchor to defaultValuedefaultValuestring | number | ReadonlyArray<string> | undefined
- Anchor to deferdeferboolean | undefined
- string | undefined
- Anchor to draggabledraggableBooleanish | undefined
- boolean | undefined
- string | undefined
- Anchor to inlistinlistany
- Anchor to inputModeinputMode'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search' | undefined
Hints at the type of data that might be entered by the user while editing the element or its contents
- Anchor to integrityintegritystring | undefined
- string | undefined
Specify that a standard HTML element should behave like a defined custom built-in element
- Anchor to itemIDitemIDstring | undefined
- Anchor to itemPropitemPropstring | undefined
- Anchor to itemRefitemRefstring | undefined
- Anchor to itemScopeitemScopeboolean | undefined
- Anchor to itemTypeitemTypestring | undefined
- Anchor to langlangstring | undefined
- Anchor to noModulenoModuleboolean | undefined
- Anchor to noncenoncestring | undefined
- Anchor to onAbortonAbortReactEventHandler<T> | undefined
- Anchor to onAbortCaptureonAbortCaptureReactEventHandler<T> | undefined
- Anchor to onAnimationEndonAnimationEndAnimationEventHandler<T> | undefined
- Anchor to onAnimationEndCaptureonAnimationEndCaptureAnimationEventHandler<T> | undefined
- Anchor to onAnimationIterationonAnimationIterationAnimationEventHandler<T> | undefined
- Anchor to onAnimationIterationCaptureonAnimationIterationCaptureAnimationEventHandler<T> | undefined
- Anchor to onAnimationStartonAnimationStartAnimationEventHandler<T> | undefined
- Anchor to onAnimationStartCaptureonAnimationStartCaptureAnimationEventHandler<T> | undefined
- Anchor to onAuxClickonAuxClickMouseEventHandler<T> | undefined
- Anchor to onAuxClickCaptureonAuxClickCaptureMouseEventHandler<T> | undefined
- Anchor to onBeforeInputonBeforeInputFormEventHandler<T> | undefined
- Anchor to onBeforeInputCaptureonBeforeInputCaptureFormEventHandler<T> | undefined
- Anchor to onBluronBlurFocusEventHandler<T> | undefined
- Anchor to onBlurCaptureonBlurCaptureFocusEventHandler<T> | undefined
- Anchor to onCanPlayonCanPlayReactEventHandler<T> | undefined
- Anchor to onCanPlayCaptureonCanPlayCaptureReactEventHandler<T> | undefined
- Anchor to onCanPlayThroughonCanPlayThroughReactEventHandler<T> | undefined
- Anchor to onCanPlayThroughCaptureonCanPlayThroughCaptureReactEventHandler<T> | undefined
- Anchor to onChangeonChangeFormEventHandler<T> | undefined
- Anchor to onChangeCaptureonChangeCaptureFormEventHandler<T> | undefined
- Anchor to onClickonClickMouseEventHandler<T> | undefined
- Anchor to onClickCaptureonClickCaptureMouseEventHandler<T> | undefined
- Anchor to onCompositionEndonCompositionEndCompositionEventHandler<T> | undefined
- Anchor to onCompositionEndCaptureonCompositionEndCaptureCompositionEventHandler<T> | undefined
- Anchor to onCompositionStartonCompositionStartCompositionEventHandler<T> | undefined
- Anchor to onCompositionStartCaptureonCompositionStartCaptureCompositionEventHandler<T> | undefined
- Anchor to onCompositionUpdateonCompositionUpdateCompositionEventHandler<T> | undefined
- Anchor to onCompositionUpdateCaptureonCompositionUpdateCaptureCompositionEventHandler<T> | undefined
- MouseEventHandler<T> | undefined
- MouseEventHandler<T> | undefined
- Anchor to onCopyonCopyClipboardEventHandler<T> | undefined
- Anchor to onCopyCaptureonCopyCaptureClipboardEventHandler<T> | undefined
- Anchor to onCutonCutClipboardEventHandler<T> | undefined
- Anchor to onCutCaptureonCutCaptureClipboardEventHandler<T> | undefined
- Anchor to onDoubleClickonDoubleClickMouseEventHandler<T> | undefined
- Anchor to onDoubleClickCaptureonDoubleClickCaptureMouseEventHandler<T> | undefined
- Anchor to onDragonDragDragEventHandler<T> | undefined
- Anchor to onDragCaptureonDragCaptureDragEventHandler<T> | undefined
- Anchor to onDragEndonDragEndDragEventHandler<T> | undefined
- Anchor to onDragEndCaptureonDragEndCaptureDragEventHandler<T> | undefined
- Anchor to onDragEnteronDragEnterDragEventHandler<T> | undefined
- Anchor to onDragEnterCaptureonDragEnterCaptureDragEventHandler<T> | undefined
- Anchor to onDragExitonDragExitDragEventHandler<T> | undefined
- Anchor to onDragExitCaptureonDragExitCaptureDragEventHandler<T> | undefined
- Anchor to onDragLeaveonDragLeaveDragEventHandler<T> | undefined
- Anchor to onDragLeaveCaptureonDragLeaveCaptureDragEventHandler<T> | undefined
- Anchor to onDragOveronDragOverDragEventHandler<T> | undefined
- Anchor to onDragOverCaptureonDragOverCaptureDragEventHandler<T> | undefined
- Anchor to onDragStartonDragStartDragEventHandler<T> | undefined
- Anchor to onDragStartCaptureonDragStartCaptureDragEventHandler<T> | undefined
- Anchor to onDroponDropDragEventHandler<T> | undefined
- Anchor to onDropCaptureonDropCaptureDragEventHandler<T> | undefined
- Anchor to onDurationChangeonDurationChangeReactEventHandler<T> | undefined
- Anchor to onDurationChangeCaptureonDurationChangeCaptureReactEventHandler<T> | undefined
- Anchor to onEmptiedonEmptiedReactEventHandler<T> | undefined
- Anchor to onEmptiedCaptureonEmptiedCaptureReactEventHandler<T> | undefined
- Anchor to onEncryptedonEncryptedReactEventHandler<T> | undefined
- Anchor to onEncryptedCaptureonEncryptedCaptureReactEventHandler<T> | undefined
- Anchor to onEndedonEndedReactEventHandler<T> | undefined
- Anchor to onEndedCaptureonEndedCaptureReactEventHandler<T> | undefined
- Anchor to onErroronErrorReactEventHandler<T> | undefined
- Anchor to onErrorCaptureonErrorCaptureReactEventHandler<T> | undefined
- Anchor to onFocusonFocusFocusEventHandler<T> | undefined
- Anchor to onFocusCaptureonFocusCaptureFocusEventHandler<T> | undefined
- Anchor to onGotPointerCaptureonGotPointerCapturePointerEventHandler<T> | undefined
- Anchor to onGotPointerCaptureCaptureonGotPointerCaptureCapturePointerEventHandler<T> | undefined
- Anchor to onInputonInputFormEventHandler<T> | undefined
- Anchor to onInputCaptureonInputCaptureFormEventHandler<T> | undefined
- Anchor to onInvalidonInvalidFormEventHandler<T> | undefined
- Anchor to onInvalidCaptureonInvalidCaptureFormEventHandler<T> | undefined
- Anchor to onKeyDownonKeyDownKeyboardEventHandler<T> | undefined
- Anchor to onKeyDownCaptureonKeyDownCaptureKeyboardEventHandler<T> | undefined
- Anchor to onKeyUponKeyUpKeyboardEventHandler<T> | undefined
- Anchor to onKeyUpCaptureonKeyUpCaptureKeyboardEventHandler<T> | undefined
- Anchor to onLoadonLoadReactEventHandler<T> | undefined
- Anchor to onLoadCaptureonLoadCaptureReactEventHandler<T> | undefined
- Anchor to onLoadedDataonLoadedDataReactEventHandler<T> | undefined
- Anchor to onLoadedDataCaptureonLoadedDataCaptureReactEventHandler<T> | undefined
- Anchor to onLoadedMetadataonLoadedMetadataReactEventHandler<T> | undefined
- Anchor to onLoadedMetadataCaptureonLoadedMetadataCaptureReactEventHandler<T> | undefined
- Anchor to onLoadStartonLoadStartReactEventHandler<T> | undefined
- Anchor to onLoadStartCaptureonLoadStartCaptureReactEventHandler<T> | undefined
- Anchor to onLostPointerCaptureonLostPointerCapturePointerEventHandler<T> | undefined
- Anchor to onLostPointerCaptureCaptureonLostPointerCaptureCapturePointerEventHandler<T> | undefined
- Anchor to onMouseDownonMouseDownMouseEventHandler<T> | undefined
- Anchor to onMouseDownCaptureonMouseDownCaptureMouseEventHandler<T> | undefined
- Anchor to onMouseEnteronMouseEnterMouseEventHandler<T> | undefined
- Anchor to onMouseLeaveonMouseLeaveMouseEventHandler<T> | undefined
- Anchor to onMouseMoveonMouseMoveMouseEventHandler<T> | undefined
- Anchor to onMouseMoveCaptureonMouseMoveCaptureMouseEventHandler<T> | undefined
- Anchor to onMouseOutonMouseOutMouseEventHandler<T> | undefined
- Anchor to onMouseOutCaptureonMouseOutCaptureMouseEventHandler<T> | undefined
- Anchor to onMouseOveronMouseOverMouseEventHandler<T> | undefined
- Anchor to onMouseOverCaptureonMouseOverCaptureMouseEventHandler<T> | undefined
- Anchor to onMouseUponMouseUpMouseEventHandler<T> | undefined
- Anchor to onMouseUpCaptureonMouseUpCaptureMouseEventHandler<T> | undefined
- Anchor to onPasteonPasteClipboardEventHandler<T> | undefined
- Anchor to onPasteCaptureonPasteCaptureClipboardEventHandler<T> | undefined
- Anchor to onPauseonPauseReactEventHandler<T> | undefined
- Anchor to onPauseCaptureonPauseCaptureReactEventHandler<T> | undefined
- Anchor to onPlayonPlayReactEventHandler<T> | undefined
- Anchor to onPlayCaptureonPlayCaptureReactEventHandler<T> | undefined
- Anchor to onPlayingonPlayingReactEventHandler<T> | undefined
- Anchor to onPlayingCaptureonPlayingCaptureReactEventHandler<T> | undefined
- Anchor to onPointerCancelonPointerCancelPointerEventHandler<T> | undefined
- Anchor to onPointerCancelCaptureonPointerCancelCapturePointerEventHandler<T> | undefined
- Anchor to onPointerDownonPointerDownPointerEventHandler<T> | undefined
- Anchor to onPointerDownCaptureonPointerDownCapturePointerEventHandler<T> | undefined
- Anchor to onPointerEnteronPointerEnterPointerEventHandler<T> | undefined
- Anchor to onPointerEnterCaptureonPointerEnterCapturePointerEventHandler<T> | undefined
- Anchor to onPointerLeaveonPointerLeavePointerEventHandler<T> | undefined
- Anchor to onPointerLeaveCaptureonPointerLeaveCapturePointerEventHandler<T> | undefined
- Anchor to onPointerMoveonPointerMovePointerEventHandler<T> | undefined
- Anchor to onPointerMoveCaptureonPointerMoveCapturePointerEventHandler<T> | undefined
- Anchor to onPointerOutonPointerOutPointerEventHandler<T> | undefined
- Anchor to onPointerOutCaptureonPointerOutCapturePointerEventHandler<T> | undefined
- Anchor to onPointerOveronPointerOverPointerEventHandler<T> | undefined
- Anchor to onPointerOverCaptureonPointerOverCapturePointerEventHandler<T> | undefined
- Anchor to onPointerUponPointerUpPointerEventHandler<T> | undefined
- Anchor to onPointerUpCaptureonPointerUpCapturePointerEventHandler<T> | undefined
- Anchor to onProgressonProgressReactEventHandler<T> | undefined
- Anchor to onProgressCaptureonProgressCaptureReactEventHandler<T> | undefined
- Anchor to onRateChangeonRateChangeReactEventHandler<T> | undefined
- Anchor to onRateChangeCaptureonRateChangeCaptureReactEventHandler<T> | undefined
- Anchor to onResetonResetFormEventHandler<T> | undefined
- Anchor to onResetCaptureonResetCaptureFormEventHandler<T> | undefined
- Anchor to onResizeonResizeReactEventHandler<T> | undefined
- Anchor to onResizeCaptureonResizeCaptureReactEventHandler<T> | undefined
- Anchor to onScrollonScrollUIEventHandler<T> | undefined
- Anchor to onScrollCaptureonScrollCaptureUIEventHandler<T> | undefined
- Anchor to onSeekedonSeekedReactEventHandler<T> | undefined
- Anchor to onSeekedCaptureonSeekedCaptureReactEventHandler<T> | undefined
- Anchor to onSeekingonSeekingReactEventHandler<T> | undefined
- Anchor to onSeekingCaptureonSeekingCaptureReactEventHandler<T> | undefined
- Anchor to onSelectonSelectReactEventHandler<T> | undefined
- Anchor to onSelectCaptureonSelectCaptureReactEventHandler<T> | undefined
- Anchor to onStalledonStalledReactEventHandler<T> | undefined
- Anchor to onStalledCaptureonStalledCaptureReactEventHandler<T> | undefined
- Anchor to onSubmitonSubmitFormEventHandler<T> | undefined
- Anchor to onSubmitCaptureonSubmitCaptureFormEventHandler<T> | undefined
- Anchor to onSuspendonSuspendReactEventHandler<T> | undefined
- Anchor to onSuspendCaptureonSuspendCaptureReactEventHandler<T> | undefined
- Anchor to onTimeUpdateonTimeUpdateReactEventHandler<T> | undefined
- Anchor to onTimeUpdateCaptureonTimeUpdateCaptureReactEventHandler<T> | undefined
- Anchor to onTouchCancelonTouchCancelTouchEventHandler<T> | undefined
- Anchor to onTouchCancelCaptureonTouchCancelCaptureTouchEventHandler<T> | undefined
- Anchor to onTouchEndonTouchEndTouchEventHandler<T> | undefined
- Anchor to onTouchEndCaptureonTouchEndCaptureTouchEventHandler<T> | undefined
- Anchor to onTouchMoveonTouchMoveTouchEventHandler<T> | undefined
- Anchor to onTouchMoveCaptureonTouchMoveCaptureTouchEventHandler<T> | undefined
- Anchor to onTouchStartonTouchStartTouchEventHandler<T> | undefined
- Anchor to onTouchStartCaptureonTouchStartCaptureTouchEventHandler<T> | undefined
- Anchor to onTransitionEndonTransitionEndTransitionEventHandler<T> | undefined
- Anchor to onTransitionEndCaptureonTransitionEndCaptureTransitionEventHandler<T> | undefined
- Anchor to onVolumeChangeonVolumeChangeReactEventHandler<T> | undefined
- Anchor to onVolumeChangeCaptureonVolumeChangeCaptureReactEventHandler<T> | undefined
- Anchor to onWaitingonWaitingReactEventHandler<T> | undefined
- Anchor to onWaitingCaptureonWaitingCaptureReactEventHandler<T> | undefined
- Anchor to onWheelonWheelWheelEventHandler<T> | undefined
- Anchor to onWheelCaptureonWheelCaptureWheelEventHandler<T> | undefined
- Anchor to placeholderplaceholderstring | undefined
- Anchor to prefixprefixstring | undefined
- Anchor to propertypropertystring | undefined
- Anchor to radioGroupradioGroupstring | undefined
- Anchor to referrerPolicyreferrerPolicyHTMLAttributeReferrerPolicy | undefined
- string | undefined
- Anchor to resourceresourcestring | undefined
- Anchor to resultsresultsnumber | undefined
- string | undefined
- Anchor to roleroleAriaRole | undefined
- Anchor to securitysecuritystring | undefined
- Anchor to slotslotstring | undefined
- Anchor to spellCheckspellCheckBooleanish | undefined
- string | undefined
- Anchor to stylestyleCSSProperties | undefined
- Anchor to suppressContentEditableWarningsuppressContentEditableWarningboolean | undefined
- Anchor to suppressHydrationWarningsuppressHydrationWarningboolean | undefined
- Anchor to tabIndextabIndexnumber | undefined
- Anchor to titletitlestring | undefined
- Anchor to translatetranslate'yes' | 'no' | undefined
- Anchor to typetypestring | undefined
- Anchor to typeoftypeofstring | undefined
- Anchor to unselectableunselectable'on' | 'off' | undefined
- Anchor to vocabvocabstring | undefined
- Anchor to aria-dropeffectaria-dropeffect'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup' | undefined
Indicates what functions can be performed when a dragged object is released on the drop target.
Deprecatedin ARIA 1.1
- Anchor to aria-grabbedaria-grabbedBooleanish | undefined
Indicates an element's "grabbed" state in a drag-and-drop operation.
Deprecatedin ARIA 1.1
- Anchor to charSetcharSetstring | undefined
- Deprecated
Deprecated
- Anchor to onKeyPressonKeyPressKeyboardEventHandler<T> | undefined
- Deprecated
Deprecated
- Anchor to onKeyPressCaptureonKeyPressCaptureKeyboardEventHandler<T> | undefined
- Deprecated
Deprecated
ScriptProps
HydrogenScriptProps & ScriptAttributes
HydrogenScriptProps
- waitForHydration
Wait to load the script until after the page hydrates. This prevents hydration errors for scripts that modify the DOM. Note: For security, `nonce` is not supported when using `waitForHydration`. Instead you need to add the domain of the script directly to your [Content Securitiy Policy directives](https://shopify.dev/docs/storefronts/headless/hydrogen/content-security-policy#step-3-customize-the-content-security-policy).
boolean
interface HydrogenScriptProps {
/** Wait to load the script until after the page hydrates. This prevents hydration errors for scripts that modify the DOM. Note: For security, `nonce` is not supported when using `waitForHydration`. Instead you need to add the domain of the script directly to your [Content Securitiy Policy directives](https://shopify.dev/docs/storefronts/headless/hydrogen/content-security-policy#step-3-customize-the-content-security-policy).*/
waitForHydration?: boolean;
}
ScriptAttributes
- about
string | undefined
- accessKey
string | undefined
- aria-activedescendant
Identifies the currently active element when DOM focus is on a composite widget, textbox, group, or application.
string | undefined
- aria-atomic
Indicates whether assistive technologies will present all, or only parts of, the changed region based on the change notifications defined by the aria-relevant attribute.
Booleanish | undefined
- aria-autocomplete
Indicates whether inputting text could trigger display of one or more predictions of the user's intended value for an input and specifies how predictions would be presented if they are made.
'none' | 'inline' | 'list' | 'both' | undefined
- aria-braillelabel
Defines a string value that labels the current element, which is intended to be converted into Braille.
string | undefined
- aria-brailleroledescription
Defines a human-readable, author-localized abbreviated description for the role of an element, which is intended to be converted into Braille.
string | undefined
- aria-busy
Booleanish | undefined
- aria-checked
Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
boolean | 'false' | 'mixed' | 'true' | undefined
- aria-colcount
Defines the total number of columns in a table, grid, or treegrid.
number | undefined
- aria-colindex
Defines an element's column index or position with respect to the total number of columns within a table, grid, or treegrid.
number | undefined
- aria-colindextext
Defines a human readable text alternative of aria-colindex.
string | undefined
- aria-colspan
Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
number | undefined
- aria-controls
Identifies the element (or elements) whose contents or presence are controlled by the current element.
string | undefined
- aria-current
Indicates the element that represents the current item within a container or set of related elements.
boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time' | undefined
- aria-describedby
Identifies the element (or elements) that describes the object.
string | undefined
- aria-description
Defines a string value that describes or annotates the current element.
string | undefined
- aria-details
Identifies the element that provides a detailed, extended description for the object.
string | undefined
- aria-disabled
Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
Booleanish | undefined
- aria-dropeffect
Indicates what functions can be performed when a dragged object is released on the drop target.
'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup' | undefined
- aria-errormessage
Identifies the element that provides an error message for the object.
string | undefined
- aria-expanded
Indicates whether the element, or another grouping element it controls, is currently expanded or collapsed.
Booleanish | undefined
- aria-flowto
Identifies the next element (or elements) in an alternate reading order of content which, at the user's discretion, allows assistive technology to override the general default of reading in document source order.
string | undefined
- aria-grabbed
Indicates an element's "grabbed" state in a drag-and-drop operation.
Booleanish | undefined
- aria-haspopup
Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.
boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | undefined
- aria-hidden
Indicates whether the element is exposed to an accessibility API.
Booleanish | undefined
- aria-invalid
Indicates the entered value does not conform to the format expected by the application.
boolean | 'false' | 'true' | 'grammar' | 'spelling' | undefined
- aria-keyshortcuts
Indicates keyboard shortcuts that an author has implemented to activate or give focus to an element.
string | undefined
- aria-label
Defines a string value that labels the current element.
string | undefined
- aria-labelledby
Identifies the element (or elements) that labels the current element.
string | undefined
- aria-level
Defines the hierarchical level of an element within a structure.
number | undefined
- aria-live
Indicates that an element will be updated, and describes the types of updates the user agents, assistive technologies, and user can expect from the live region.
'off' | 'assertive' | 'polite' | undefined
- aria-modal
Indicates whether an element is modal when displayed.
Booleanish | undefined
- aria-multiline
Indicates whether a text box accepts multiple lines of input or only a single line.
Booleanish | undefined
- aria-multiselectable
Indicates that the user may select more than one item from the current selectable descendants.
Booleanish | undefined
- aria-orientation
Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous.
'horizontal' | 'vertical' | undefined
- aria-owns
Identifies an element (or elements) in order to define a visual, functional, or contextual parent/child relationship between DOM elements where the DOM hierarchy cannot be used to represent the relationship.
string | undefined
- aria-placeholder
Defines a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format.
string | undefined
- aria-posinset
Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
number | undefined
- aria-pressed
Indicates the current "pressed" state of toggle buttons.
boolean | 'false' | 'mixed' | 'true' | undefined
- aria-readonly
Indicates that the element is not editable, but is otherwise operable.
Booleanish | undefined
- aria-relevant
Indicates what notifications the user agent will trigger when the accessibility tree within a live region is modified.
'additions' | 'additions removals' | 'additions text' | 'all' | 'removals' | 'removals additions' | 'removals text' | 'text' | 'text additions' | 'text removals' | undefined
- aria-required
Indicates that user input is required on the element before a form may be submitted.
Booleanish | undefined
- aria-roledescription
Defines a human-readable, author-localized description for the role of an element.
string | undefined
- aria-rowcount
Defines the total number of rows in a table, grid, or treegrid.
number | undefined
- aria-rowindex
Defines an element's row index or position with respect to the total number of rows within a table, grid, or treegrid.
number | undefined
- aria-rowindextext
Defines a human readable text alternative of aria-rowindex.
string | undefined
- aria-rowspan
Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
number | undefined
- aria-selected
Indicates the current "selected" state of various widgets.
Booleanish | undefined
- aria-setsize
Defines the number of items in the current set of listitems or treeitems. Not required if all elements in the set are present in the DOM.
number | undefined
- aria-sort
Indicates if items in a table or grid are sorted in ascending or descending order.
'none' | 'ascending' | 'descending' | 'other' | undefined
- aria-valuemax
Defines the maximum allowed value for a range widget.
number | undefined
- aria-valuemin
Defines the minimum allowed value for a range widget.
number | undefined
- aria-valuenow
Defines the current value for a range widget.
number | undefined
- aria-valuetext
Defines the human readable text alternative of aria-valuenow for a range widget.
string | undefined
- async
boolean | undefined
- autoCapitalize
string | undefined
- autoCorrect
string | undefined
- autoFocus
boolean | undefined
- autoSave
string | undefined
- charSet
string | undefined
- children
ReactNode | undefined
- className
string | undefined
- color
string | undefined
- content
string | undefined
- contentEditable
Booleanish | "inherit" | undefined
- contextMenu
string | undefined
- crossOrigin
CrossOrigin
- dangerouslySetInnerHTML
{ // Should be InnerHTML['innerHTML']. // But unfortunately we're mixing renderer-specific type declarations. __html: string | TrustedHTML; } | undefined
- datatype
string | undefined
- defaultChecked
boolean | undefined
- defaultValue
string | number | ReadonlyArray<string> | undefined
- defer
boolean | undefined
- dir
string | undefined
- draggable
Booleanish | undefined
- hidden
boolean | undefined
- id
string | undefined
- inlist
any
- inputMode
Hints at the type of data that might be entered by the user while editing the element or its contents
'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search' | undefined
- integrity
string | undefined
- is
Specify that a standard HTML element should behave like a defined custom built-in element
string | undefined
- itemID
string | undefined
- itemProp
string | undefined
- itemRef
string | undefined
- itemScope
boolean | undefined
- itemType
string | undefined
- lang
string | undefined
- noModule
boolean | undefined
- nonce
string | undefined
- onAbort
ReactEventHandler<T> | undefined
- onAbortCapture
ReactEventHandler<T> | undefined
- onAnimationEnd
AnimationEventHandler<T> | undefined
- onAnimationEndCapture
AnimationEventHandler<T> | undefined
- onAnimationIteration
AnimationEventHandler<T> | undefined
- onAnimationIterationCapture
AnimationEventHandler<T> | undefined
- onAnimationStart
AnimationEventHandler<T> | undefined
- onAnimationStartCapture
AnimationEventHandler<T> | undefined
- onAuxClick
MouseEventHandler<T> | undefined
- onAuxClickCapture
MouseEventHandler<T> | undefined
- onBeforeInput
FormEventHandler<T> | undefined
- onBeforeInputCapture
FormEventHandler<T> | undefined
- onBlur
FocusEventHandler<T> | undefined
- onBlurCapture
FocusEventHandler<T> | undefined
- onCanPlay
ReactEventHandler<T> | undefined
- onCanPlayCapture
ReactEventHandler<T> | undefined
- onCanPlayThrough
ReactEventHandler<T> | undefined
- onCanPlayThroughCapture
ReactEventHandler<T> | undefined
- onChange
FormEventHandler<T> | undefined
- onChangeCapture
FormEventHandler<T> | undefined
- onClick
MouseEventHandler<T> | undefined
- onClickCapture
MouseEventHandler<T> | undefined
- onCompositionEnd
CompositionEventHandler<T> | undefined
- onCompositionEndCapture
CompositionEventHandler<T> | undefined
- onCompositionStart
CompositionEventHandler<T> | undefined
- onCompositionStartCapture
CompositionEventHandler<T> | undefined
- onCompositionUpdate
CompositionEventHandler<T> | undefined
- onCompositionUpdateCapture
CompositionEventHandler<T> | undefined
- onContextMenu
MouseEventHandler<T> | undefined
- onContextMenuCapture
MouseEventHandler<T> | undefined
- onCopy
ClipboardEventHandler<T> | undefined
- onCopyCapture
ClipboardEventHandler<T> | undefined
- onCut
ClipboardEventHandler<T> | undefined
- onCutCapture
ClipboardEventHandler<T> | undefined
- onDoubleClick
MouseEventHandler<T> | undefined
- onDoubleClickCapture
MouseEventHandler<T> | undefined
- onDrag
DragEventHandler<T> | undefined
- onDragCapture
DragEventHandler<T> | undefined
- onDragEnd
DragEventHandler<T> | undefined
- onDragEndCapture
DragEventHandler<T> | undefined
- onDragEnter
DragEventHandler<T> | undefined
- onDragEnterCapture
DragEventHandler<T> | undefined
- onDragExit
DragEventHandler<T> | undefined
- onDragExitCapture
DragEventHandler<T> | undefined
- onDragLeave
DragEventHandler<T> | undefined
- onDragLeaveCapture
DragEventHandler<T> | undefined
- onDragOver
DragEventHandler<T> | undefined
- onDragOverCapture
DragEventHandler<T> | undefined
- onDragStart
DragEventHandler<T> | undefined
- onDragStartCapture
DragEventHandler<T> | undefined
- onDrop
DragEventHandler<T> | undefined
- onDropCapture
DragEventHandler<T> | undefined
- onDurationChange
ReactEventHandler<T> | undefined
- onDurationChangeCapture
ReactEventHandler<T> | undefined
- onEmptied
ReactEventHandler<T> | undefined
- onEmptiedCapture
ReactEventHandler<T> | undefined
- onEncrypted
ReactEventHandler<T> | undefined
- onEncryptedCapture
ReactEventHandler<T> | undefined
- onEnded
ReactEventHandler<T> | undefined
- onEndedCapture
ReactEventHandler<T> | undefined
- onError
ReactEventHandler<T> | undefined
- onErrorCapture
ReactEventHandler<T> | undefined
- onFocus
FocusEventHandler<T> | undefined
- onFocusCapture
FocusEventHandler<T> | undefined
- onGotPointerCapture
PointerEventHandler<T> | undefined
- onGotPointerCaptureCapture
PointerEventHandler<T> | undefined
- onInput
FormEventHandler<T> | undefined
- onInputCapture
FormEventHandler<T> | undefined
- onInvalid
FormEventHandler<T> | undefined
- onInvalidCapture
FormEventHandler<T> | undefined
- onKeyDown
KeyboardEventHandler<T> | undefined
- onKeyDownCapture
KeyboardEventHandler<T> | undefined
- onKeyPress
KeyboardEventHandler<T> | undefined
- onKeyPressCapture
KeyboardEventHandler<T> | undefined
- onKeyUp
KeyboardEventHandler<T> | undefined
- onKeyUpCapture
KeyboardEventHandler<T> | undefined
- onLoad
ReactEventHandler<T> | undefined
- onLoadCapture
ReactEventHandler<T> | undefined
- onLoadedData
ReactEventHandler<T> | undefined
- onLoadedDataCapture
ReactEventHandler<T> | undefined
- onLoadedMetadata
ReactEventHandler<T> | undefined
- onLoadedMetadataCapture
ReactEventHandler<T> | undefined
- onLoadStart
ReactEventHandler<T> | undefined
- onLoadStartCapture
ReactEventHandler<T> | undefined
- onLostPointerCapture
PointerEventHandler<T> | undefined
- onLostPointerCaptureCapture
PointerEventHandler<T> | undefined
- onMouseDown
MouseEventHandler<T> | undefined
- onMouseDownCapture
MouseEventHandler<T> | undefined
- onMouseEnter
MouseEventHandler<T> | undefined
- onMouseLeave
MouseEventHandler<T> | undefined
- onMouseMove
MouseEventHandler<T> | undefined
- onMouseMoveCapture
MouseEventHandler<T> | undefined
- onMouseOut
MouseEventHandler<T> | undefined
- onMouseOutCapture
MouseEventHandler<T> | undefined
- onMouseOver
MouseEventHandler<T> | undefined
- onMouseOverCapture
MouseEventHandler<T> | undefined
- onMouseUp
MouseEventHandler<T> | undefined
- onMouseUpCapture
MouseEventHandler<T> | undefined
- onPaste
ClipboardEventHandler<T> | undefined
- onPasteCapture
ClipboardEventHandler<T> | undefined
- onPause
ReactEventHandler<T> | undefined
- onPauseCapture
ReactEventHandler<T> | undefined
- onPlay
ReactEventHandler<T> | undefined
- onPlayCapture
ReactEventHandler<T> | undefined
- onPlaying
ReactEventHandler<T> | undefined
- onPlayingCapture
ReactEventHandler<T> | undefined
- onPointerCancel
PointerEventHandler<T> | undefined
- onPointerCancelCapture
PointerEventHandler<T> | undefined
- onPointerDown
PointerEventHandler<T> | undefined
- onPointerDownCapture
PointerEventHandler<T> | undefined
- onPointerEnter
PointerEventHandler<T> | undefined
- onPointerEnterCapture
PointerEventHandler<T> | undefined
- onPointerLeave
PointerEventHandler<T> | undefined
- onPointerLeaveCapture
PointerEventHandler<T> | undefined
- onPointerMove
PointerEventHandler<T> | undefined
- onPointerMoveCapture
PointerEventHandler<T> | undefined
- onPointerOut
PointerEventHandler<T> | undefined
- onPointerOutCapture
PointerEventHandler<T> | undefined
- onPointerOver
PointerEventHandler<T> | undefined
- onPointerOverCapture
PointerEventHandler<T> | undefined
- onPointerUp
PointerEventHandler<T> | undefined
- onPointerUpCapture
PointerEventHandler<T> | undefined
- onProgress
ReactEventHandler<T> | undefined
- onProgressCapture
ReactEventHandler<T> | undefined
- onRateChange
ReactEventHandler<T> | undefined
- onRateChangeCapture
ReactEventHandler<T> | undefined
- onReset
FormEventHandler<T> | undefined
- onResetCapture
FormEventHandler<T> | undefined
- onResize
ReactEventHandler<T> | undefined
- onResizeCapture
ReactEventHandler<T> | undefined
- onScroll
UIEventHandler<T> | undefined
- onScrollCapture
UIEventHandler<T> | undefined
- onSeeked
ReactEventHandler<T> | undefined
- onSeekedCapture
ReactEventHandler<T> | undefined
- onSeeking
ReactEventHandler<T> | undefined
- onSeekingCapture
ReactEventHandler<T> | undefined
- onSelect
ReactEventHandler<T> | undefined
- onSelectCapture
ReactEventHandler<T> | undefined
- onStalled
ReactEventHandler<T> | undefined
- onStalledCapture
ReactEventHandler<T> | undefined
- onSubmit
FormEventHandler<T> | undefined
- onSubmitCapture
FormEventHandler<T> | undefined
- onSuspend
ReactEventHandler<T> | undefined
- onSuspendCapture
ReactEventHandler<T> | undefined
- onTimeUpdate
ReactEventHandler<T> | undefined
- onTimeUpdateCapture
ReactEventHandler<T> | undefined
- onTouchCancel
TouchEventHandler<T> | undefined
- onTouchCancelCapture
TouchEventHandler<T> | undefined
- onTouchEnd
TouchEventHandler<T> | undefined
- onTouchEndCapture
TouchEventHandler<T> | undefined
- onTouchMove
TouchEventHandler<T> | undefined
- onTouchMoveCapture
TouchEventHandler<T> | undefined
- onTouchStart
TouchEventHandler<T> | undefined
- onTouchStartCapture
TouchEventHandler<T> | undefined
- onTransitionEnd
TransitionEventHandler<T> | undefined
- onTransitionEndCapture
TransitionEventHandler<T> | undefined
- onVolumeChange
ReactEventHandler<T> | undefined
- onVolumeChangeCapture
ReactEventHandler<T> | undefined
- onWaiting
ReactEventHandler<T> | undefined
- onWaitingCapture
ReactEventHandler<T> | undefined
- onWheel
WheelEventHandler<T> | undefined
- onWheelCapture
WheelEventHandler<T> | undefined
- placeholder
string | undefined
- prefix
string | undefined
- property
string | undefined
- radioGroup
string | undefined
- referrerPolicy
HTMLAttributeReferrerPolicy | undefined
- rel
string | undefined
- resource
string | undefined
- results
number | undefined
- rev
string | undefined
- role
AriaRole | undefined
- security
string | undefined
- slot
string | undefined
- spellCheck
Booleanish | undefined
- src
string | undefined
- style
CSSProperties | undefined
- suppressContentEditableWarning
boolean | undefined
- suppressHydrationWarning
boolean | undefined
- tabIndex
number | undefined
- title
string | undefined
- translate
'yes' | 'no' | undefined
- type
string | undefined
- typeof
string | undefined
- unselectable
'on' | 'off' | undefined
- vocab
string | undefined
interface ScriptAttributes extends ScriptHTMLAttributes<HTMLScriptElement> {}
Example code
examples
Example code
description
I am the default example
JavaScript
import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration, } from 'react-router'; import {useNonce, Script} from '@shopify/hydrogen'; export default function App() { const nonce = useNonce(); return ( <html lang="en"> <head> <meta charSet="utf-8" /> <meta name="viewport" content="width=device-width,initial-scale=1" /> <Meta /> <Links /> </head> <body> <Outlet /> {/* Note you don't need to pass a nonce to the script component because it's automatically added */} <Script src="https://some-custom-script.js" /> {/* For security, nonce is not supported with `waitForHydration`. Instead you need to add the domain of the script directly to your Content Securitiy Policy directives. */} <Script waitForHydration src="https://domain.com/script-that-modifies-dom.js" /> <ScrollRestoration nonce={nonce} /> <Scripts nonce={nonce} /> <LiveReload nonce={nonce} /> </body> </html> ); }
TypeScript
import {Links, Meta, Outlet, Scripts, ScrollRestoration} from 'react-router'; import {useNonce, Script} from '@shopify/hydrogen'; export default function App() { const nonce = useNonce(); return ( <html lang="en"> <head> <meta charSet="utf-8" /> <meta name="viewport" content="width=device-width,initial-scale=1" /> <Meta /> <Links /> </head> <body> <Outlet /> {/* Note you don't need to pass a nonce to the script component because it's automatically added */} <Script src="https://some-custom-script.js" /> {/* For security, nonce is not supported with `waitForHydration`. Instead you need to add the domain of the script directly to your Content Securitiy Policy directives. */} <Script waitForHydration src="https://domain.com/script-that-modifies-dom.js" /> <ScrollRestoration nonce={nonce} /> <Scripts nonce={nonce} /> </body> </html> ); }