
## Feature Examples


### Size
- description: <p>Control button size with <code>size</code> prop:</p><li><code>large</code> is best for calls to action that require more emphasis. </li><li><code>medium</code> is for main page actions and common use cases.</li><li><code>small</code> fits into smaller UI elements like cards and widgets.</li><li><code>tiny</code> is used for dense layouts.</li>
- example: 
```jsx 
<StorybookComponents.Stack>
  <Button size="large">Large</Button>
  <Button size="medium">Medium</Button>
  <Button size="small">Small</Button>
  <Button size="tiny">Tiny</Button>
</StorybookComponents.Stack>;
```

### Priority
- description: <p>Each button has a <code>priority</code> that signals its importance. Use it to create a clear visual hierarchy across actions on the page.</p><p></p><li><code>primary</code> is the main call-to-action. </li><li><code>secondary</code> is for supporting actions alongside a primary (e.g. Cancel, Back).</li><li><code>tertiary</code> is for low-emphasis actions; use when secondary would still feel too prominent.</li><p></p><p><em>Note</em>: There should only be one primary button per page.</p>
- example: 
```jsx 
() => (
  <Box gap="12px" verticalAlign="middle">
    <Button>Primary</Button>
    <Button priority="secondary">Secondary</Button>
    <Button priority="tertiary">Tertiary</Button>
  </Box>
);
```

### Skin
- description: <p>Change the appearance of a button with a <code>skin</code> prop.  </p><li><code>standard</code> is for general primary actions.</li><li><code>light</code> is for primary actions that are on dark backgrounds. </li><li><code>destructive</code> is only for actions that have a destructive effect on user data, like delete.</li><li><code>premium</code> is for actions that prompt users to upgrade their plans to premium subscription.</li><li><code>premium-light</code> is best for upgrade actions that appear on dark backgrounds.</li><li><code>dark</code> should be used with buttons on backgrounds with colors.  </li><li><code>transparent</code> is for general actions on backgrounds with vivid colors or images.</li><li><code>ai</code> should be used with AI based features.</li>
- example: 
```jsx 
() => (
  <Box direction="vertical" gap="40px">
    <Box gap="20px" verticalAlign="middle">
      <Button>Standard Primary</Button>
      <Button priority="secondary">Standard Secondary</Button>
      <Button priority="tertiary">Standard Tertiary</Button>
    </Box>
    <Box gap="20px" backgroundColor="D10" padding="6px" verticalAlign="middle">
      <Button skin="light">Light Primary</Button>
      <Button skin="light" priority="secondary">
        Light Secondary
      </Button>
      <Button skin="light" priority="tertiary">
        Light Tertiary
      </Button>
    </Box>
    <Box gap="20px" verticalAlign="middle">
      <Button skin="destructive">Destructive Primary</Button>
      <Button skin="destructive" priority="secondary">
        Destructive Secondary
      </Button>
      <Button skin="destructive" priority="tertiary">
        Destructive Tertiary
      </Button>
    </Box>
    <Box gap="20px" verticalAlign="middle">
      <Button skin="premium">Premium Primary</Button>
      <Button skin="premium" priority="secondary">
        Premium Secondary
      </Button>
      <Button skin="premium" priority="tertiary">
        Premium Tertiary
      </Button>
    </Box>
    <Box gap="20px" backgroundColor="D10" padding="6px" verticalAlign="middle">
      <Button skin="premium-light">Premium Light Primary</Button>
      <Button skin="premium-light" priority="secondary">
        Premium Light Secondary
      </Button>
      <Button skin="premium-light" priority="tertiary">
        Premium Light Tertiary
      </Button>
    </Box>
    <Box gap="20px" verticalAlign="middle">
      <Button skin="dark">Dark Primary</Button>
      <Button skin="dark" priority="secondary">
        Dark Secondary
      </Button>
      <Button skin="dark" priority="tertiary">
        Dark Tertiary
      </Button>
    </Box>
    <Box
      gap="20px"
      backgroundColor="#3899EB"
      padding="6px"
      verticalAlign="middle"
    >
      <Button skin="transparent">Transparent Primary</Button>
      <Button skin="transparent" priority="secondary">
        Transparent Secondary
      </Button>
      <Button skin="transparent" priority="tertiary">
        Transparent Tertiary
      </Button>
    </Box>
    <Box gap="20px" verticalAlign="middle">
      <Button skin="ai">Ai Primary</Button>
      <Button skin="ai" priority="secondary">
        Ai Secondary
      </Button>
      <Button skin="ai" priority="tertiary">
        Ai Tertiary
      </Button>
    </Box>
  </Box>
);
```

### Affix
- description: <p>Add more context to actions with affix icons:</p><li>Emphasize the button action with a <code>prefixIcon</code>.</li><li>Indicate that an action will open a popover or navigate users to another page with a <code>suffixIcon</code>.</li>
- example: 
```jsx 
<StorybookComponents.Stack flexDirection="line">
  <StorybookComponents.Stack flexDirection="column">
    <StorybookComponents.Stack>
      <Button size="large" prefixIcon={<Icons.Add />}>
        Prefix
      </Button>
    </StorybookComponents.Stack>
    <StorybookComponents.Stack>
      <Button size="medium" prefixIcon={<Icons.Add />}>
        Prefix
      </Button>
    </StorybookComponents.Stack>
    <StorybookComponents.Stack>
      <Button size="small" prefixIcon={<Icons.AddSmall />}>
        Prefix
      </Button>
    </StorybookComponents.Stack>
    <StorybookComponents.Stack>
      <Button size="tiny" prefixIcon={<Icons.AddSmall />}>
        Prefix
      </Button>
    </StorybookComponents.Stack>
  </StorybookComponents.Stack>
  <StorybookComponents.Stack flexDirection="column">
    <StorybookComponents.Stack>
      <Button size="large" suffixIcon={<Icons.ChevronDown />}>
        Suffix
      </Button>
    </StorybookComponents.Stack>
    <StorybookComponents.Stack>
      <Button size="medium" suffixIcon={<Icons.ChevronDown />}>
        Suffix
      </Button>
    </StorybookComponents.Stack>
    <StorybookComponents.Stack>
      <Button size="small" suffixIcon={<Icons.ChevronDownSmall />}>
        Suffix
      </Button>
    </StorybookComponents.Stack>
    <StorybookComponents.Stack>
      <Button size="tiny" suffixIcon={<Icons.ChevronDownSmall />}>
        Suffix
      </Button>
    </StorybookComponents.Stack>
  </StorybookComponents.Stack>
</StorybookComponents.Stack>;
```

### Disabled
- description: <p>To disable a button, use the <code>disabled</code> prop which indicates a button can't be selected.</p>
- example: 
```jsx 
<Button disabled>Disabled</Button>
```

### Text overflow
- description: <p>Use the <code>ellipsis</code> prop for overflow text. The full text will be displayed in a <code><Tooltip/></code> when a user hovers over the button. Control the style of the tooltip using the <code>tooltipProps</code>.</p><p></p><p><em>Note</em>: Try to avoid lengthy action labels. CTA text should be short and clear – one to two words, or max three for specific use cases.</p>
- example: 
```jsx 
<StorybookComponents.Stack flexDirection="column" width="180px">
  <Button ellipsis>
    This label exceeds available space and is shown in a tooltip
  </Button>
</StorybookComponents.Stack>;
```

### Full width
- description: <p>When working on mobile designs, use the <code>fullWidth</code> prop to fill the button to 100% of the parent container.</p>
- example: 
```jsx 
<Button fullWidth>Full width</Button>
```




## Developer Examples


### Custom HTML tag
- description: <p>Render buttons as any given HTML tag with the <code>as</code> prop. For example, they can be rendered as:</p><li> <code><a></code> when attributes like href, target, etc., are needed. </li><li><code><Link></code> when props like to, replace, etc. are needed.</li><p></p><p>All attributes will be passed to the rendered HTML tag.</p>
- example: 
```jsx 
() => {
  const ReactRouterLink = props => <div {...props} />;
  return (
    <StorybookComponents.Stack>
      <Button as="a" href="https://www.wix.com" target="_blank">
        {'Native <a/> tag'}
      </Button>
      <Button as={ReactRouterLink} skin="premium" to="/home">
        {'React Router <Link/> tag'}
      </Button>
      <Button as="button" onClick={() => alert('yay')}>
        {'Native <button/> tag'}
      </Button>
    </StorybookComponents.Stack>
  );
};
```


    


## Common Use Case Examples


### Loading state
- description: <p>When an action is delayed and still loading, use <code><Loader/></code> <a href="https://www.wix-style-react.com/storybook/?path=/story/components-feedback--loader&previewId=22f5352e-1f78-4f97-8edc-1a1d5a42ff77&storyName=Button"></a>instead of a label on the button.</p>
- example: 
```jsx 
<CustomModalLayout
  primaryButtonText={<Loader size="tiny" />}
  secondaryButtonText="Cancel"
  onCloseButtonClick={() => {}}
  title="Add menu"
>
  <Layout>
    <Cell>
      <FormField label="Name">
        <Input value="Brunch Menu" />
      </FormField>
    </Cell>
    <Cell>
      <FormField label="Description">
        <InputArea value="Brunch includes pastries, fruits, omelettes, coffee, and more." />
      </FormField>
    </Cell>
    <Cell>
      <Box>
        <FormField label="Visible to customers" labelPlacement="right" stretchContent={false}>
          <ToggleSwitch checked />
        </FormField>
      </Box>
    </Cell>
  </Layout>
</CustomModalLayout>;
```

### Main action of a panel
- description: <p>Place the primary CTA button in the <code><SidePanel.Footer/></code> to make sure it is always clearly visible to the user. </p>
- example: 
```jsx 
<SidePanel
  onCloseButtonClick={() => {}}
  skin="floating"
  width="288px"
  height="576px"
>
  <SidePanel.Header title="Manage Accordion" />
  <SidePanel.Content noPadding>
    <NestableList
      withBottomBorder
      items={[
        {
          id: 1,
          options: [{ value: <Text size="small">Color</Text> }],
          dragHandleSize: 'small',
        },
        {
          id: 2,
          options: [{ value: <Text size="small">Price</Text> }],
          dragHandleSize: 'small',
        },
        {
          id: 3,
          options: [{ value: <Text size="small">Size</Text> }],
          dragHandleSize: 'small',
        },
        {
          id: 4,
          options: [{ value: <Text size="small">Collections</Text> }],
          dragHandleSize: 'small',
        },
      ]}
      onChange={() => {}}
    />
  </SidePanel.Content>
  <SidePanel.Footer>
    <Box direction="vertical" align="center">
      <Button size="small">Add Item</Button>
    </Box>
  </SidePanel.Footer>
</SidePanel>;
```

### Priority of actions
- description: <p>Not all actions are equal. Ranking them visually tells users what to do first, what's optional, and what's just there if they need it.</p>
- example: 
```jsx 
() => (
  <Box width="460px">
    <Card>
      <Card.Header
        title="Publish Site"
        subtitle="Last edited 2 hours ago by you"
      />
      <Card.Divider />
      <Card.Content>
        <Text size="small" secondary>
          Publishing will make all changes visible to your visitors.
        </Text>
      </Card.Content>
      <Card.Divider />
      <Card.Content>
        <Box verticalAlign="middle" gap="12px">
          <Button>Publish now</Button>
          <Button priority="secondary">Save draft</Button>
          <Box marginLeft="12px">
            <Button priority="tertiary">Preview</Button>
          </Box>
        </Box>
      </Card.Content>
    </Card>
  </Box>
);

```

### Disabled state
- description: <p>Disable the primary button when required fields are missing, and automatically enable it once all inputs are completed.</p>
- example: 
```jsx 
() => {
  const [name, setName] = React.useState('');
  const [email, setEmail] = React.useState('');

  const isReady = name.trim().length > 0 && email.includes('@');

  return (
    <Box width="460px">
      <Card>
        <Card.Header
          title="Invite team member"
          subtitle="Fill in the required fields to send the invitation."
        />
        <Card.Divider />
        <Card.Content>
          <Box direction="vertical" gap="18px">
            <FormField label="Full name" required>
              <Input
                placeholder="Jane Smith"
                value={name}
                onChange={(e) => setName(e.target.value)}
              />
            </FormField>
            <FormField label="Email address" required>
              <Input
                placeholder="jane@example.com"
                value={email}
                onChange={(e) => setEmail(e.target.value)}
              />
            </FormField>
          </Box>
        </Card.Content>
        <Card.Divider />
        <Card.Content>
          <Box verticalAlign="middle" gap="12px">
            <Button disabled={!isReady}>Send invite</Button>
            <Button priority="secondary">Cancel</Button>
          </Box>
        </Card.Content>
      </Card>
    </Box>
  );
};
```


