When using two icons, reserve iconAfter for icons that provide a clear affordance for the user when selecting on the button. Arrows and chevrons are best reserved for iconAfter.
For buttons whose disabled state is relevant to assistive technologies such as screen readers, use the ariaDisabled prop. The ariaDisabled prop will only be applied when the disabled prop is true.
By default, ariaDisabled is unset, excluding disabled buttons from the DOM. Users relying on assistive technologies will not be notified of the button's existence.
The ariaDisabled prop should be set to true when the disabled semantics should be conveyed. Best practice is to use ariaDisabled when a button is disabled in a field due to missing entries or when an upgrade is needed to access a feature.
<Tooltipcontent='Upgrade to premium to access this feature'tabIndex={-1}>
<ButtonisDisabledariaDisabled>
Premium button
</Button>
</Tooltip>
RefHandler
Use the refHandler prop to pass down a function that creates/sets your ref from Button's parent component.
()=>{
const ref =useRef();
constrefHandler=(newRef)=>{
ref.current= newRef;
// You can check console outputs
console.log("Assigned ref to button",{ newRef });
}
return(
<>
<ButtonrefHandler={refHandler}>A button with ref value</Button>
</>
)}
HTML tag
Change the HTML wrapper tag with htmlTag prop. Use the download prop to indicate that the linked resource is intended to be downloaded rather than displayed in the browser. For download links, best practice is to specify the title, type and size of the file explicitly or in aria-label.
Like the Atlaskit Button component, if you use the interactionName prop, then the button will start tracing a press event within UFO when it is clicked. More about press tracing