Back to Twenty

Buttons

packages/twenty-docs/twenty-ui/input/buttons.mdx

2.2.012.6 KB
Original Source
<Frame> </Frame>

A list of buttons and button groups used throughout the app.

Button

<Tabs> <Tab title="Usage">
jsx
import { Button } from "@/ui/input/button/components/Button";

export const MyComponent = () => {
  return (
    <Button
      className
      Icon={null}
      title="Title"
      fullWidth={false}
      variant="primary"
      size="medium"
      position="standalone"
      accent="default"
      soon={false}
      disabled={false}
      focus={true}
      onClick={() => console.log("click")}
    />
  );
};
</Tab> <Tab title="Props">
PropsTypeDescription
classNamestringOptional class name for additional styling
IconReact.ComponentTypeAn optional icon component that's displayed within the button
titlestringThe text content of the button
fullWidthbooleanDefines whether the button should span the whole width of its container
variantstringThe visual style variant of the button. Options include primary, secondary, and tertiary
sizestringThe size of the button. Has two options: small and medium
positionstringThe position of the button in relation to its siblings. Options include: standalone, left, right, and middle
accentstringThe accent color of the button. Options include: default, blue, and danger
soonbooleanIndicates if the button is marked as "soon" (such as for upcoming features)
disabledbooleanSpecifies whether the button is disabled or not
focusbooleanDetermines if the button has focus
onClickfunctionA callback function that triggers when the user clicks on the button
</Tab> </Tabs>

Button Group

<Tabs> <Tab title="Usage"> ```jsx import { Button } from "@/ui/input/button/components/Button"; import { ButtonGroup } from "@/ui/input/button/components/ButtonGroup";

export const MyComponent = () => { return ( <ButtonGroup variant="primary" size="large" accent="blue" className> <Button className Icon={null} title="Button 1" fullWidth={false} variant="primary" size="medium" position="standalone" accent="blue" soon={false} disabled={false} focus={false} onClick={() => console.log("click")} /> <Button className Icon={null} title="Button 2" fullWidth={false} variant="secondary" size="medium" position="left" accent="blue" soon={false} disabled={false} focus={false} onClick={() => console.log("click")} /> <Button className Icon={null} title="Button 3" fullWidth={false} variant="tertiary" size="medium" position="right" accent="blue" soon={false} disabled={false} focus={false} onClick={() => console.log("click")} /> </ButtonGroup> ); };

</Tab>

<Tab title="Props">


| Props | Type | Description |
|-------|------|-------------|
| variant | string | The visual style variant of the buttons within the group. Options include `primary`, `secondary`, and `tertiary` |
| size | string | The size of the buttons within the group. Has two options: `medium` and `small` |
| accent | string | The accent color of the buttons within the group. Options include `default`, `blue` and `danger` |
| className | string | Optional class name for additional styling |
| children | ReactNode | An array of React elements representing the individual buttons within the group |



</Tab>
</Tabs>


## Floating Button

<Tabs>
<Tab title="Usage">

```jsx
import { FloatingButton } from "@/ui/input/button/components/FloatingButton";
import { IconSearch } from "@tabler/icons-react";

export const MyComponent = () => {
  return (
    <FloatingButton
      className
      Icon={IconSearch}
      title="Title"
      size="medium"
      position="standalone"
      applyShadow={true}
      applyBlur={true}
      disabled={false}
      focus={true}
    />
  );
};
</Tab> <Tab title="Props">
PropsTypeDescription
classNamestringOptional name for additional styling
IconReact.ComponentTypeAn optional icon component that's displayed within the button
titlestringThe text content of the button
sizestringThe size of the button. Has two options: small and medium
positionstringThe position of the button in relation to its siblings. Options include: standalone, left, middle, right
applyShadowbooleanDetermines whether to apply shadow to a button
applyBlurbooleanDetermines whether to apply a blur effect to the button
disabledbooleanDetermines whether the button is disabled
focusbooleanIndicates if the button has focus
</Tab> </Tabs>

Floating Button Group

<Tabs> <Tab title="Usage">
jsx
import { FloatingButton } from "@/ui/input/button/components/FloatingButton";
import { FloatingButtonGroup } from "@/ui/input/button/components/FloatingButtonGroup";
import { IconClipboardText, IconCheckbox } from "@tabler/icons-react";

export const MyComponent = () => {
  return (
    <FloatingButtonGroup size="small">
      <FloatingButton
        className
        Icon={IconClipboardText}
        title
        size="small"
        position="standalone"
        applyShadow={true}
        applyBlur={true}
        disabled={false}
        focus={true}
      />
      <FloatingButton
        className
        Icon={IconCheckbox}
        title
        size="small"
        position="standalone"
        applyShadow={true}
        applyBlur={true}
        disabled={false}
      />
    </FloatingButtonGroup>
  );
};
</Tab> <Tab title="Props">
PropsTypeDescriptionDefault
sizestringThe size of the button. Has two options: small and mediumsmall
childrenReactNodeAn array of React elements representing the individual buttons within the group
</Tab> </Tabs>

Floating Icon Button

<Tabs> <Tab title="Usage">
jsx
import { FloatingIconButton } from "@/ui/input/button/components/FloatingIconButton";
import { IconSearch } from "@tabler/icons-react";

export const MyComponent = () => {
  return (
    <FloatingIconButton
      className
      Icon={IconSearch}
      size="small"
      position="standalone"
      applyShadow={true}
      applyBlur={true}
      disabled={false}
      focus={false}
      onClick={() => console.log("click")}
      isActive={true}
    />
  );
};
</Tab> <Tab title="Props">
PropsTypeDescription
classNamestringOptional name for additional styling
IconReact.ComponentTypeAn optional icon component that's displayed within the button
sizestringThe size of the button. Has two options: small and medium
positionstringThe position of the button in relation to its siblings. Options include: standalone, left, right, and middle
applyShadowbooleanDetermines whether to apply shadow to a button
applyBlurbooleanDetermines whether to apply a blur effect to the button
disabledbooleanDetermines whether the button is disabled
focusbooleanIndicates if the button has focus
onClickfunctionA callback function that triggers when the user clicks on the button
isActivebooleanDetermines if the button is in an active state
</Tab> </Tabs>

Floating Icon Button Group

<Tabs> <Tab title="Usage">
jsx
import { FloatingIconButtonGroup } from "@/ui/input/button/components/FloatingIconButtonGroup";
import { IconClipboardText, IconCheckbox } from "@tabler/icons-react";

export const MyComponent = () => {
  const iconButtons = [
    {
      Icon: IconClipboardText,
      onClick: () => console.log("Button 1 clicked"),
      isActive: true,
    },
    {
      Icon: IconCheckbox,
      onClick: () => console.log("Button 2 clicked"),
      isActive: true,
    },
  ];

  return (
    <FloatingIconButtonGroup
    className
    size="small"
    iconButtons={iconButtons} />
  );
};

</Tab> <Tab title="Props">
PropsTypeDescription
classNamestringOptional name for additional styling
sizestringThe size of the button. Has two options: small and medium
iconButtonsarrayAn array of objects, each representing an icon button in the group. Each object should include the icon component you want to display in the button, the function you want to call when a user clicks on the button, and whether the button should be active or not.
</Tab> </Tabs>

Light Button

<Tabs> <Tab title="Usage">
jsx
import { LightButton } from "@/ui/input/button/components/LightButton";

export const MyComponent = () => {
  return <LightButton
  className
  icon={null}
  title="Title"
  accent="secondary"
  active={false}
  disabled={false}
  focus={true}
  onClick={()=>console.log('click')}
  />;
};
</Tab> <Tab title="Props">
PropsTypeDescription
classNamestringOptional name for additional styling
iconReact.ReactNodeThe icon you want to display in the button
titlestringThe text content of the button
accentstringThe accent color of the button. Options include: secondary and tertiary
activebooleanDetermines if the button is in an active state
disabledbooleanDetermines whether the button is disabled
focusbooleanIndicates if the button has focus
onClickfunctionA callback function that triggers when the user clicks on the button
</Tab> </Tabs>

Light Icon Button

<Tabs> <Tab title="Usage">
jsx
import { LightIconButton } from "@/ui/input/button/components/LightIconButton";
import { IconSearch } from "@tabler/icons-react";

export const MyComponent = () => {
  return (
    <LightIconButton
      className
      testId="test1"
      Icon={IconSearch}
      title="Title"
      size="small"
      accent="secondary"
      active={true}
      disabled={false}
      focus={true}
      onClick={() => console.log("click")}
    />
  );
};
</Tab> <Tab title="Props">
PropsTypeDescription
classNamestringOptional name for additional styling
testIdstringTest identifier for the button
IconReact.ComponentTypeAn optional icon component that's displayed within the button
titlestringThe text content of the button
sizestringThe size of the button. Has two options: small and medium
accentstringThe accent color of the button. Options include: secondary and tertiary
activebooleanDetermines if the button is in an active state
disabledbooleanDetermines whether the button is disabled
focusbooleanIndicates if the button has focus
onClickfunctionA callback function that triggers when the user clicks on the button
</Tab> </Tabs>

Main Button

<Tabs> <Tab title="Usage">
jsx
import { MainButton } from "@/ui/input/button/components/MainButton";
import { IconCheckbox } from "@tabler/icons-react";

export const MyComponent = () => {
  return (
    <MainButton
      title="Checkbox"
      fullWidth={false}
      variant="primary"
      soon={false}
      Icon={IconCheckbox}
    />
  );
};
</Tab> <Tab title="Props">
PropsTypeDescription
titlestringThe text content of the button
fullWidthbooleanDefines whether the button should span the whole width of its container
variantstringThe visual style variant of the button. Options include primary and secondary
soonbooleanIndicates if the button is marked as "soon" (such as for upcoming features)
IconReact.ComponentTypeAn optional icon component that's displayed within the button
React button propsReact.ComponentProps<'button'>All standard HTML button props are supported
</Tab> </Tabs>

Rounded Icon Button

<Tabs> <Tab title="Usage">
jsx
import { RoundedIconButton } from "@/ui/input/button/components/RoundedIconButton";
import { IconSearch } from "@tabler/icons-react";

export const MyComponent = () => {
  return (
    <RoundedIconButton
      Icon={IconSearch}
    />
  );
};
</Tab> <Tab title="Props">
PropsTypeDescription
IconReact.ComponentType
React button propsReact.ButtonHTMLAttributes<HTMLButtonElement>
</Tab> </Tabs>