MCPcopy Create free account
hub / github.com/nodejs/nodejs.org / BaseButton

Function BaseButton

packages/ui-components/src/Common/BaseButton/index.tsx:18–57  ·  view source on GitHub ↗
({
  kind = 'primary',
  size = 'default',
  disabled = false,
  className,
  as: Component = 'a',
  ...props
})

Source from the content-addressed store, hash-verified

16};
17
18const BaseButton: FC<ButtonProps> = ({
19 kind = 'primary',
20 size = 'default',
21 disabled = false,
22 className,
23 as: Component = 'a',
24 ...props
25}) => {
26 if ('href' in props && Component) {
27 return (
28 <Component
29 role="button"
30 href={disabled ? undefined : props.href}
31 aria-disabled={disabled}
32 className={classNames(
33 styles.button,
34 styles[kind],
35 styles[size],
36 className
37 )}
38 tabIndex={disabled ? -1 : 0}
39 {...props}
40 />
41 );
42 }
43
44 return (
45 <button
46 disabled={disabled}
47 className={classNames(
48 styles.button,
49 styles[kind],
50 styles[size],
51 className
52 )}
53 type="button"
54 {...(props as ButtonHTMLAttributes<HTMLButtonElement>)}
55 />
56 );
57};
58
59export default BaseButton;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected