MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / Button

Function Button

apps/web/ui/Button/index.tsx:29–103  ·  view source on GitHub ↗
({
  className,
  type,
  block,
  children,
  onClick,
  disabled = false,
  color = 'blue',
  rounded = 'lg',
  size = 'sm',
  weight = 'medium',
  outlined,
  style,
  tag,
}: Props)

Source from the content-addressed store, hash-verified

27}
28
29const Button = ({
30 className,
31 type,
32 block,
33 children,
34 onClick,
35 disabled = false,
36 color = 'blue',
37 rounded = 'lg',
38 size = 'sm',
39 weight = 'medium',
40 outlined,
41 style,
42 tag,
43}: Props) => {
44 if (tag === 'a') {
45 <a
46 type={type}
47 onClick={onClick}
48 style={style}
49 className={classNames(styles.button, className, {
50 [styles.block]: block,
51 [styles.medium]: weight === 'medium',
52 [styles.bold]: weight === 'bold',
53 [styles['rounded-lg']]: rounded === 'lg',
54 [styles['rounded-md']]: rounded === 'md',
55 [styles['rounded-full']]: rounded === 'full',
56 [styles.md]: size === 'md',
57 [styles.sm]: size === 'sm',
58 [styles.xs]: size === 'xs',
59 [styles.disabled]: disabled,
60 [styles.white]: color === 'white',
61 [styles.gray]: color === 'gray',
62 [styles.blue]: color === 'blue',
63 [styles.yellow]: color === 'yellow',
64 [styles.black]: color === 'black',
65 [styles.transparent]: color === 'transparent',
66 [styles.danger]: color === 'danger',
67 [styles.outlined]: outlined,
68 })}
69 >
70 {children}
71 </a>;
72 }
73 return (
74 <button
75 disabled={disabled}
76 type={type}
77 onClick={onClick}
78 style={style}
79 className={classNames(styles.button, className, {
80 [styles.block]: block,
81 [styles.medium]: weight === 'medium',
82 [styles.bold]: weight === 'bold',
83 [styles['rounded-lg']]: rounded === 'lg',
84 [styles['rounded-md']]: rounded === 'md',
85 [styles['rounded-full']]: rounded === 'full',
86 [styles.md]: size === 'md',

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected