## Feature Examples

### Structure
- description: Thumbnails have 3 optional content areas: - `image` - `title` - `description`
- example:
```jsx
<StorybookComponents.Stack>
  <Thumbnail
    image={<Image />}
    title={
      <StorybookComponents.Placeholder>Title</StorybookComponents.Placeholder>
    }
    description={
      <StorybookComponents.Placeholder>
        Description
      </StorybookComponents.Placeholder>
    }
  />
</StorybookComponents.Stack>;
```

### Size
- description: Adjust the component size using `size` prop. It supports 3 sizes: - `medium` (default) is the standard used in common cases. - `small` is used for smaller elements and more compact designs. - `tiny` is best for dense layouts.
- example:
```jsx
<StorybookComponents.Stack flexDirection="column">
  <Thumbnail size="medium" title="Medium" description="Size" />
  <Thumbnail size="small" title="Small" description="Size" />
  <Thumbnail size="tiny" title="Tiny" description="Size" />
</StorybookComponents.Stack>;
```

### Skin
- description: Change the thumbnail appearance using the `skin` prop. Two skin options are currently available. Use the `secondary` skin in panels that include thumbnails, such as environments like the Wix Harmony Editor.
- example:
```jsx
<StorybookComponents.Stack>
  <Thumbnail
    title="Skin"
    description="Default"
    image={<Image />}
    contentAlignment="top"
    width={165}
    height={200}
  />
  <Thumbnail
    title="Skin"
    skin="secondary"
    description="Secondary"
    image={<Image />}
    contentAlignment="top"
    width={165}
    height={200}
  />
</StorybookComponents.Stack>;
```

### Dimensions
- description: Set the dimensions of a thumbnail in pixels or percentages with the `height` and `width` properties.
- example:
```jsx
<StorybookComponents.Stack flexDirection="column">
  <Thumbnail title="Title" width="50%" height="120px" />
  <Thumbnail title="Title" width="25%" height="60px" />
</StorybookComponents.Stack>;
```

### Content alignment
- description: Control the vertical alignment of thumbnail content with the `contentAlignment` prop. It supports 2 options: - `center` (default) is the standard used for common cases. - `top` is used when the thumbnail list contains items with different content lengths.
- example:
```jsx
<StorybookComponents.Stack>
  <Thumbnail
    title="Center"
    description="Alignment"
    image={<Image width="90px" />}
    height={240}
    contentAlignment="center"
    width={165}
  />
  <Thumbnail
    title="Top"
    description="Alignment"
    image={<Image width="90px" />}
    height={240}
    contentAlignment="top"
    width={165}
  />
</StorybookComponents.Stack>;
```

### Text position
- description: Control the thumbnail text position with the `textPosition` prop. - `inside` (default) is used for text-only thumbnails or thumbnails that require more emphasis. - `outside` is used for side panel thumbnails or for a large group of illustrated thumbnails.
- example:
```jsx
<StorybookComponents.Stack>
  <Thumbnail
    title="Inside"
    description="Description"
    image={<Image />}
    contentAlignment="top"
    width={165}
    height={200}
  />
  <Thumbnail
    title="Outside"
    description="Alignment"
    image={<Image height="100%" />}
    contentAlignment="top"
    textPosition="outside"
    width={165}
    height={200}
  />
</StorybookComponents.Stack>;
```

### Background image
- description: Render an image as a thumbnail background with the `backgroundImage` prop. This works well for gallery selections, such as product cover images.
- example:
```jsx
<Thumbnail
  backgroundImage="example.jpg"
  width={240}
  height={240}
  title="Title"
/>;
```

### States
- description: Control the state of a component with: - `selected` to mark active selection. - `disabled` to mark an item that cannot be selected or deselected. Remove the selected item checkmark icon with the `hideSelectedIcon` prop.
- example:
```jsx
<StorybookComponents.Stack gap="12px">
  <Thumbnail title="Default" width={140} />
  <Thumbnail title="Selected" selected width={140} />
  <Thumbnail title="Disabled" disabled width={140} />
  <Thumbnail
    title="Disabled with image"
    disabled
    image={<Image />}
    width={140}
  />
  <Thumbnail
    title="Disabled with image background"
    disabled
    backgroundImage="example.jpg"
    height={120}
    width={140}
  />
</StorybookComponents.Stack>;
```

### Status message
- description: Add text that explains the status or what action the user should take with the `statusMessage` prop. Show the status message inline, directly below the thumbnails, by wrapping it in a `<FormField/>` and adding `statusMessage`. View more inline status message examples in `<FormField/>`.
- example:
```jsx
<FormField status="error" statusMessage="This is an error message.">
  <StorybookComponents.Stack gap="12px">
    <Thumbnail title="Option 1" width={140} />
    <Thumbnail title="Option 2" width={140} />
    <Thumbnail title="Option 3" width={140} />
  </StorybookComponents.Stack>
</FormField>;
```

### Custom content
- description: Place any image, component or set of components inside the thumbnail content area.
- example:
```jsx
<Thumbnail title="Title" width="50%">
  <StorybookComponents.Stack padding="24px">
    <StorybookComponents.Placeholder>Content</StorybookComponents.Placeholder>
  </StorybookComponents.Stack>
</Thumbnail>;
```

## Common Use Case Examples

### List of options
- description: Use a thumbnail to create a list of options with icons as visual cues.
- example:
```jsx
() => {
  const [selected, setSelected] = React.useState(0);

  const renderCell = ({ id, title, src }) => (
    <Cell span={2}>
      <Thumbnail
        size="small"
        title={<Text>{title}</Text>}
        selected={selected === id}
        onClick={() => setSelected(id)}
      >
        <Proportion>
          <Box height="100%" width="100%" align="center" verticalAlign="middle">
            <Image src={src} height="24px" width="24px" transparent />
          </Box>
        </Proportion>
      </Thumbnail>
    </Cell>
  );

  return (
    <Card>
      <Card.Header title="Add label to contact" />
      <Divider />
      <Card.Content>
        <Layout>
          <Cell span={12}>
            <Text>Decide how you want to respond to the trigger</Text>
          </Cell>
          {renderCell({
            id: 0,
            title: 'Send email to contacts',
            src: 'contacts.svg',
          })}
          {renderCell({
            id: 1,
            title: 'Send a chat message',
            src: 'chat_message.svg',
          })}
          {renderCell({
            id: 2,
            title: 'Get notified by email',
            src: 'email_notify.svg',
          })}
          {renderCell({
            id: 3,
            title: 'Create a task',
            src: 'task.svg',
          })}
        </Layout>
      </Card.Content>
    </Card>
  );
};
```

### Gallery selection
- description: Use a thumbnail with `backgroundImage` to construct gallery selections.
- example:
```jsx
() => {
  const [selected, setSelected] = React.useState(0);

  return (
    <Layout cols={1}>
      <FormField label="Cover Image">
        <Box gap="12px">
          <Thumbnail
            backgroundImage="TravelExample1.jpg"
            width={64}
            height={64}
            selected={selected === 0}
            onClick={() => setSelected(0)}
          />
          <Thumbnail
            backgroundImage="TravelExample2.jpg"
            width={64}
            height={64}
            selected={selected === 1}
            onClick={() => setSelected(1)}
          />
          <Thumbnail
            backgroundImage="TravelExample3.jpg"
            width={64}
            height={64}
            selected={selected === 2}
            onClick={() => setSelected(2)}
          />
          <Thumbnail
            backgroundImage="TravelExample4.jpg"
            width={64}
            height={64}
            selected={selected === 3}
            onClick={() => setSelected(3)}
          />
          <Thumbnail
            backgroundImage="TravelExample5.jpg"
            width={64}
            height={64}
            selected={selected === 4}
            onClick={() => setSelected(4)}
          />
        </Box>
      </FormField>
    </Layout>
  );
};
```

### Custom content with details
- description: Render custom content inside of a thumbnail to give more details about each option. For example, add graphics, images or links to learn more.
- example:
```jsx
() => {
  const [selected, setSelected] = React.useState(0);

  const renderThumbnail = ({ title, subtitle, id }) => (
    <Thumbnail selected={selected === id} onClick={() => setSelected(id)}>
      <Box padding="18px">
        <Box gap="12px" verticalAlign="middle">
          <Icons.Public />
          <Box direction="vertical">
            <Text size="medium" weight="bold">
              {title}
            </Text>
            <Box>
              <Text size="small" secondary>
                {subtitle}
              </Text>
            </Box>
          </Box>
        </Box>
      </Box>
    </Thumbnail>
  );

  return (
    <Card>
      <Card.Header title="Group info" />
      <Card.Divider />
      <Card.Content>
        <Layout cols={12}>
          <Cell span={8}>
            <Layout cols={1}>
              <FormField label="Name">
                <Input placeholder="Enter group name" />
              </FormField>
              <FormField
                label="Privacy"
                infoContent="Choose who can see and join this group"
              >
                <Layout cols={1} gap="12px">
                  {renderThumbnail({
                    title: 'Public',
                    subtitle: 'Anyone can view this group',
                    id: 0,
                  })}
                  {renderThumbnail({
                    title: 'Private',
                    subtitle: 'Only approved members can view this group',
                    id: 1,
                  })}
                  {renderThumbnail({
                    title: 'Hidden',
                    subtitle: 'Group is hidden and requires an invite to join',
                    id: 2,
                  })}
                </Layout>
              </FormField>
            </Layout>
          </Cell>
        </Layout>
      </Card.Content>
    </Card>
  );
};
```

### Settings panel
- description: Use illustrations in thumbnails to demonstrate the result of the user's selection.
- example:
```jsx
() => {
  const [selectedDirection, setSelectedDirection] = React.useState(0);
  const [selectedAlignment, setSelectedAlignment] = React.useState(1);

  return (
    <SidePanel onCloseButtonClick={() => {}} skin="floating" width="288px">
      <SidePanel.Header title="Text Input Layout" />
      <SidePanel.Content noPadding>
        <SidePanel.Field>
          <FieldSet
            legend="Direction"
            direction="horizontal"
            columns="auto auto"
          >
            <Thumbnail
              size="tiny"
              selected={selectedDirection === 0}
              onClick={() => setSelectedDirection(0)}
              hideSelectedIcon
              height={54}
              noPadding
              image={
                <Image
                  src="ThumbnailIllustration_LTR.svg"
                  transparent
                  fit="none"
                />
              }
              title="Left to right"
              textPosition="outside"
            />
            <Thumbnail
              size="tiny"
              selected={selectedDirection === 1}
              onClick={() => setSelectedDirection(1)}
              hideSelectedIcon
              height={54}
              noPadding
              image={
                <Image
                  src="ThumbnailIllustration_RTL.svg"
                  transparent
                  fit="none"
                />
              }
              title="Right to left"
              textPosition="outside"
            />
          </FieldSet>
        </SidePanel.Field>
        <SidePanel.Field>
          <FieldSet
            legend="Alignment"
            direction="horizontal"
            columns="38px 38px 38px"
          >
            <Thumbnail
              size="tiny"
              selected={selectedAlignment === 0}
              onClick={() => setSelectedAlignment(0)}
              hideSelectedIcon
              height={38}
              noPadding
              image={
                <Image
                  src="ThumbnailIllustration_AlignLeft.svg"
                  transparent
                  fit="none"
                />
              }
              textPosition="outside"
            />
            <Thumbnail
              size="tiny"
              selected={selectedAlignment === 1}
              onClick={() => setSelectedAlignment(1)}
              hideSelectedIcon
              height={38}
              noPadding
              image={
                <Image
                  src="ThumbnailIllustration_AlignCenter.svg"
                  transparent
                  fit="none"
                />
              }
              textPosition="outside"
            />
            <Thumbnail
              size="tiny"
              selected={selectedAlignment === 2}
              onClick={() => setSelectedAlignment(2)}
              hideSelectedIcon
              height={38}
              noPadding
              image={
                <Image
                  src="ThumbnailIllustration_AlignRight.svg"
                  transparent
                  fit="none"
                />
              }
              textPosition="outside"
            />
          </FieldSet>
        </SidePanel.Field>
      </SidePanel.Content>
    </SidePanel>
  );
};
```
