## Feature Examples

### Size
- description: Control the size of a component with `size` prop: - `large` - use when item height is >212 px. - `medium` - use when item height is between 162 px and 212 px. - `small` - use when item height is between 120 px and 162 px. - `tiny` (default) - use when item height is between 48 px and 120 px. `size` prop affects component's padding and icon size. Its height and width also depend on a parent container. Minimum height of a component is: - 48 px for `dashes`, - 42 px for `plain`, and - 81×81 px for `image` themes.
- example:
```jsx
<StorybookComponents.Stack flexDirection="column">
  <AddItem size="large">Large</AddItem>
  <AddItem size="medium">Medium</AddItem>
  <AddItem size="small">Small</AddItem>
  <AddItem size="tiny">Tiny</AddItem>
</StorybookComponents.Stack>;
```

### Theme
- description: Control the style of a component with `theme` prop: - `dashes` (default) - use it outside of a card, in a table or a list that contains images. - `plain` - use for in-card lists and tables that mainly consist of text. - `filled` - use for small in-card items, when a prominent call to action is needed. - `image` - use to add images inside a card.
- example:
```jsx
<StorybookComponents.Stack flexDirection="column">
  <AddItem theme="dashes">Dashes</AddItem>
  <AddItem theme="plain">Plain</AddItem>
  <AddItem theme="filled">Filled</AddItem>
  <AddItem theme="image">Image</AddItem>
</StorybookComponents.Stack>;
```

### Alignment
- description: Control content alignment with `alignItems` prop: - `left` - `center` (default) - `right` Use `left` alignment with a `plain` component theme to maintain visual consistency with a remaining list inside a card.
- example:
```jsx
<StorybookComponents.Stack flexDirection="column">
  <AddItem theme="plain" alignItems="left">
    Left
  </AddItem>
  <AddItem theme="plain" alignItems="center">
    Center
  </AddItem>
  <AddItem theme="plain" alignItems="right">
    Right
  </AddItem>
</StorybookComponents.Stack>;
```

### Padding
- description: Control whether a component has padding with `removePadding` prop. Use it in special cases only, when component is used in dense and narrow layouts.
- example:
```jsx
<StorybookComponents.Stack flexDirection="column">
  <AddItem>Default</AddItem>
  <AddItem removePadding>No padding</AddItem>
</StorybookComponents.Stack>;
```

### Border radius
- description: Control the border radius of a component with `borderRadius` prop. By default, component has a corner radius of 8 px. Change it in custom scenarios, for example, when user needs to add a round avatar photo.
- example:
```jsx
<StorybookComponents.Stack width="min-content" height="100px">
  <AddItem borderRadius="8px" />
  <AddItem borderRadius="100%" />
</StorybookComponents.Stack>;
```

### Title
- description: Emphasize action with a `title`. If no title is shown, display it in a tooltip on item hover with `tooltipContent` prop.
- example:
```jsx
<StorybookComponents.Stack flexDirection="column">
  <AddItem>Title</AddItem>
  <AddItem tooltipContent="Title"></AddItem>
</StorybookComponents.Stack>;
```

### Subtitle
- description: Add a description below the title using `subtitle` prop. Use it to explain item details, such as a supported file format of a maximum allowed file size.
- example:
```jsx
<AddItem subtitle="Subtitle">Title</AddItem>;
```

### Subtitle placement
- description: Control where the subtitle appears with `subtitlePlacement` prop: - `bottom` (default) - shows the subtitle below the title. - `top` - shows the subtitle above the title. Use it when the description explains the action, and the title reads as the action itself.
- example:
```jsx
<StorybookComponents.Stack>
  <Box height="162px" width="50%">
    <AddItem size="small" subtitle="Subtitle">
      Title
    </AddItem>
  </Box>
  <Box height="162px" width="50%">
    <AddItem size="small" subtitle="Subtitle" subtitlePlacement="top">
      Title
    </AddItem>
  </Box>
</StorybookComponents.Stack>;
```

### Aligned items
- description: Line up the text of items placed side by side by giving every item an icon of the same height. An illustration passed as a source string is always rendered at a fixed size. Wrap a custom icon in a box of that size, for example 60×60 px for a `small` item.
- example:
```jsx
<StorybookComponents.Stack>
  <Box height="162px" width="50%">
    <AddItem
      size="small"
      icon="running_man.png"
      subtitle="Add images or videos of your product"
      subtitlePlacement="top"
    >
      Upload
    </AddItem>
  </Box>
  <Box height="162px" width="50%">
    <AddItem
      size="small"
      icon={
        <Box width="60px" height="60px" align="center" verticalAlign="middle">
          <Icons.AI />
        </Box>
      }
      subtitle="Turn your photos into professional product shots"
      subtitlePlacement="top"
    >
      Generate
    </AddItem>
  </Box>
</StorybookComponents.Stack>;
```

### Icon
- description: Control a '+' icon visibility with `showIcon` prop. The icon is always shown by default.
- example:
```jsx
<StorybookComponents.Stack flexDirection="column">
  <AddItem>Default</AddItem>
  <AddItem showIcon={false}>No icon</AddItem>
</StorybookComponents.Stack>;
```

### Custom icon or illustration
- description: Override a default '+' icon with a custom icon or illustration by passing it to `icon` prop. Align dimensions of the icon or illustration based on add item `size`: - Use S2 illustrations in `large` and `medium` size components. - Use S1 for `small` size component. - Use 24×24 px or 18×18 px icons for `tiny` size component.
- example:
```jsx
<StorybookComponents.Stack width="50%" flexDirection="column">
  <Box height="212px">
    <AddItem
      size="large"
      icon={
        <StorybookComponents.Placeholder width="96px" height="96px">
          <StorybookComponents.Stack
            justifyContent="center"
            height="100%"
            alignItems="center"
          >
            <Text weight="bold" secondary>
              S2
            </Text>
          </StorybookComponents.Stack>
        </StorybookComponents.Placeholder>
      }
    >
      Large
    </AddItem>
  </Box>
  <Box height="162px">
    <AddItem
      size="medium"
      icon={
        <StorybookComponents.Placeholder width="96px" height="96px">
          <StorybookComponents.Stack
            justifyContent="center"
            height="100%"
            alignItems="center"
          >
            <Text weight="bold" secondary>
              S2
            </Text>
          </StorybookComponents.Stack>
        </StorybookComponents.Placeholder>
      }
    >
      Medium
    </AddItem>
  </Box>
  <Box height="120px">
    <AddItem
      size="small"
      icon={
        <StorybookComponents.Placeholder width="60px" height="60px">
          <StorybookComponents.Stack
            justifyContent="center"
            height="100%"
            alignItems="center"
          >
            <Text weight="bold" secondary>
              S1
            </Text>
          </StorybookComponents.Stack>
        </StorybookComponents.Placeholder>
      }
    >
      Small
    </AddItem>
  </Box>
  <Box>
    <AddItem size="tiny" icon={<Icons.Image />}>
      Tiny
    </AddItem>
  </Box>
  <Box>
    <AddItem size="tiny" icon={<Icons.ImageSmall />}>
      Tiny with small icon
    </AddItem>
  </Box>
</StorybookComponents.Stack>;
```

### Disabled
- description: Disable all component interactions with `disabled` prop. Use it to show that no new item can be added to the list at a moment.
- example:
```jsx
<AddItem disabled>Disabled</AddItem>;
```

### Tooltip
- description: Describe add item action with `tooltipContent`. Tooltip is shown when users hover on the item with a mouse. Control tooltip design with `tooltipProps`.
- example:
```jsx
<AddItem
  tooltipContent="Description for the add item action"
  tooltipProps={{ placement: 'bottom' }}
>
  Hover to see tooltip
</AddItem>;
```

## Common Use Case Examples

### Inside a card
- description: Use Add item to create a new item inside a card. When the list consists mainly of textual content, use `plain` theme and adjust component's `alignment`.
- example:
```jsx
() => {
  const records = [
    {
      option: `Size`,
      vars: 'S, M, L',
    },
    {
      option: `Colors`,
      vars: 'Black, Neutral, White',
    },
    {
      option: 'Material',
      vars: 'Cotton, Eco leather',
    },
  ];

  const columns = [
    { title: 'Option', render: (row) => row.option },
    { title: 'Variations', render: (row) => row.vars },
  ];

  return (
    <Box>
      <Card hideOverflow>
        <Card.Header title="Product options"></Card.Header>
        <Table data={records} columns={columns} rowVerticalPadding="medium">
          <Table.Content />
          <AddItem theme="plain" alignItems="left">
            Add New Option
          </AddItem>
        </Table>
      </Card>
    </Box>
  );
};
```

### Inside a page
- description: Use Add item's `dashed` theme when component is placed directly inside of a `<Page/>` layout.
- example:
```jsx
<Page>
  <Page.Header title="Events" />
  <Page.Content>
    <Layout>
      <Cell span={12}>
        <Box height={160}>
          <Box align="center" verticalAlign="middle" width={180}>
            <Image
              height="180px"
              borderRadius="8px 0px 0px 8px"
              src="running_man.png"
            />
          </Box>
          <Box
            direction="vertical"
            borderRadius="0px 8px 8px 0px"
            verticalAlign="space-between"
            padding="18px 24px"
            backgroundColor="D80"
            flexGrow={1}
          >
            <Box verticalAlign="space-between" flexGrow={1}>
              <Box direction="vertical" gap="3px">
                <Heading size="small">Get running!</Heading>
                <Text size="small" secondary>
                  Scheduled for April 26, 2021
                </Text>
              </Box>
            </Box>
            <Box align="space-between">
              <Box gap="24px">
                <Box verticalAlign="middle" gap="0px">
                  <Icons.LockUnlockedSmall />
                  <Box marginLeft={1}>
                    <Text size="small">Public</Text>
                  </Box>
                </Box>
                <Box verticalAlign="middle">
                  <Box marginLeft={1}>
                    <Text size="small">Join for Free</Text>
                  </Box>
                </Box>
              </Box>
              <Box>
                <Box verticalAlign="middle">
                  <Box gap="SP2">
                    <IconButton priority="secondary" size="small">
                      <Icons.MoreSmall />
                    </IconButton>
                    <Button priority="secondary" size="small">
                      Edit
                    </Button>
                  </Box>
                </Box>
              </Box>
            </Box>
          </Box>
        </Box>
      </Cell>
      <Cell>
        <Box height={160}>
          <AddItem size="small">Add New Event</AddItem>
        </Box>
      </Cell>
    </Layout>
  </Page.Content>
</Page>;
```

### Add images
- description: Use Add item to upload images. For this, select `image` theme and show the title inside a tooltip on mouse hover.
- example:
```jsx
<Card>
  <Card.Header title="Profile" />
  <Card.Divider />
  <Card.Content>
    <Layout>
      <Cell span={6}>
        <Box direction="vertical" gap="4">
          <FormField labelSize="small" label="Business name">
            <Input placeholder="" />
          </FormField>
          <FormField labelSize="small" label="Short description">
            <InputArea
              placeholder="Add more details about your business."
              rows={3}
              hasCounter
              resizable
            />
          </FormField>
        </Box>
      </Cell>
      <Cell span={6}>
        <FormField labelSize="small" label="Logo">
          <Dropzone onDrop={() => {}}>
            <Dropzone.Content>
              <FileUpload onChange={() => {}}>
                {({ openFileUploadDialog }) => (
                  <Box height="168px">
                    <AddItem
                      theme="image"
                      tooltipContent="Add Logo"
                      size="medium"
                      onClick={openFileUploadDialog}
                    />
                  </Box>
                )}
              </FileUpload>
            </Dropzone.Content>
          </Dropzone>
        </FormField>
      </Cell>
    </Layout>
  </Card.Content>
</Card>;
```
