@awsui/components-react
Version:
AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A
19 lines (18 loc) • 1.13 kB
JavaScript
import { __assign } from "tslib";
import React from 'react';
import clsx from 'clsx';
import useFocusVisible from '../internal/hooks/focus-visible';
import Icon from '../icon';
import styles from './styles.css.js';
export var TabButton = React.forwardRef(function (_a, ref) {
var _b;
var active = _a.active, disabled = _a.disabled, iconName = _a.iconName, onClick = _a.onClick, onFocus = _a.onFocus, onBlur = _a.onBlur, tabIndex = _a.tabIndex, ariaHidden = _a.ariaHidden, paneId = _a.paneId, text = _a.text, className = _a.className;
var focusVisible = useFocusVisible();
return (React.createElement("button", __assign({ className: clsx([styles['tab-button'], className], (_b = {},
_b[styles['tab-button--active']] = active,
_b[styles['tab-button--disabled']] = disabled,
_b)), onClick: onClick, onFocus: onFocus, onBlur: onBlur, disabled: disabled, ref: ref, tabIndex: tabIndex, role: "tab", "aria-selected": active, "aria-controls": paneId, "aria-hidden": ariaHidden }, focusVisible),
React.createElement(Icon, { name: iconName }),
" ",
text));
});