HTML element to use for button
Optionalconfig: ButtonConfig = {}Button config
Protected_PrivatedebounceStatic ConstantdefaultsButton default config
StaticelementStaticmoduleName for the component used when initialising using data-module attributes.
Static ConstantschemaButton config schema
Protected$rootProtectedReturns the root element of the component
ProtectedconfigProtectedReturns the root element of the component
Internal VirtualconfigOverride
Function which defines configuration overrides to prioritize properties from the root element's dataset.
It should take a subset of configuration as input and return a new configuration object with properties that should be overridden based on the root element's dataset. A Symbol is used for indexing to prevent conflicts.
Optionalparam: Partial<ButtonConfig>Configuration object
return - Configuration object
PrivatedebouncePrivateDebounce double-clicks
If the click quickly succeeds a previous click then nothing will happen. This stops people accidentally causing multiple form submissions by double clicking buttons.
Mouse click event
Returns undefined, or false when debounced
PrivatehandlePrivateTrigger a click event when the space key is pressed
Some screen readers tell users they can use the space bar to activate things with the 'button' role, so we need to match the functionality of native HTML buttons.
See https://github.com/alphagov/govuk_elements/pull/272#issuecomment-233028270
Keydown event
Staticcheck
JavaScript enhancements for the Button component