0.42.2 • Published 28 days ago

@spectrum-web-components/thumbnail v0.42.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
28 days ago

Description

An sp-thumbnail can be used in a variety of locations as a way to display a preview of an image, layer, or effect. sp-thumbnail elements are not keyboard-focusable since they're intended to be used inside of a component that a user sets focus to (such as select lists or tree items).

Usage

See it on NPM! How big is this package in your project? Try it on webcomponents.dev

yarn add @spectrum-web-components/thumbnail

Import the side effectful registration of <sp-thumbnail> via:

import '@spectrum-web-components/thumbnail/sp-thumbnail.js';

When looking to leverage the Thumbnail base class as a type and/or for extension purposes, do so via:

import { Thumbnail } from '@spectrum-web-components/thumbnail';

Sizes

<sp-thumbnail size="50">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="75">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="100">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="200">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="300">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="400">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="500">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="600">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="700">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="800">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="900">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>
<sp-thumbnail size="1000">
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>

Focused

When focused the sp-thumbnail element will be displayed as follows:

<sp-thumbnail focused>
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>

Disabled

Thumbnail should only be displayed as disabled if the entire componet is also disabled. When disabled the sp-thumbnail element will be displayed as follows:

<sp-thumbnail disabled>
    <img src="https://picsum.photos/100/100" alt="Demo Image" />
</sp-thumbnail>

Representing non-square content

By default, an sp-thumbnail will ensure that the entirety of the content that it respresents is visible by letterboxing that content with a checkerboard background when its aspect ratio is not square.

<div style="display: flex; gap: var(--spectrum-spacing-100);">
    <sp-thumbnail>
        <img src="https://picsum.photos/300/400" alt="Demo Image" />
    </sp-thumbnail>

    <sp-thumbnail>
        <img src="https://picsum.photos/500/100" alt="Demo Image" />
    </sp-thumbnail>
</div>

The background attribute takes a string value of the CSS "background" property in order to customize the letterboxing.

<div style="display: flex; gap: var(--spectrum-spacing-100);">
    <sp-thumbnail background="red">
        <img src="https://picsum.photos/300/400" alt="Demo Image" />
    </sp-thumbnail>

    <sp-thumbnail background="#00ff00">
        <img src="https://picsum.photos/500/100" alt="Demo Image" />
    </sp-thumbnail>
</div>

The cover attribute will cause the content to fill the space provided by the sp-thumbnail element:

<div style="display: flex; gap: var(--spectrum-spacing-100);">
    <sp-thumbnail cover>
        <img src="https://picsum.photos/300/400" alt="Demo Image" />
    </sp-thumbnail>

    <sp-thumbnail cover>
        <img src="https://picsum.photos/500/100" alt="Demo Image" />
    </sp-thumbnail>
</div>

Layer and Layer Selected

For when sp-thumbail is used in layer management (such as the Compact or Detail Layers panels). The thumbnail is given a thick blue border to indicate its selection when used in layer management.

<div style="display: flex; gap: var(--spectrum-spacing-100);">
    <sp-thumbnail layer>
        <img src="https://picsum.photos/400/400" alt="Demo Image" />
    </sp-thumbnail>

    <sp-thumbnail layer selected>
        <img src="https://picsum.photos/500/100" alt="Demo Image" />
    </sp-thumbnail>
</div>
0.42.2

28 days ago

0.42.1

28 days ago

0.42.0

1 month ago

0.41.2

2 months ago

0.41.1

2 months ago

0.41.0

3 months ago

0.40.5

3 months ago

0.40.4

3 months ago

0.40.3

4 months ago

0.40.2

4 months ago

0.40.1

5 months ago

0.36.0

9 months ago

0.40.0

6 months ago

0.35.1-rc.15

9 months ago

0.37.0

9 months ago

0.34.1-rc.0

10 months ago

0.35.1-rc.25

9 months ago

0.35.1-rc.26

9 months ago

0.35.1-rc.24

9 months ago

0.38.0

8 months ago

0.35.1-rc.34

9 months ago

0.34.0

10 months ago

0.35.1-rc.43

9 months ago

0.35.1-rc.41

9 months ago

0.39.1

7 months ago

0.39.0

7 months ago

0.35.0

9 months ago

0.39.4

6 months ago

0.39.3

7 months ago

0.39.2

7 months ago

0.33.3-overlay.66

10 months ago

0.33.3-overlay.65

10 months ago

0.33.3-overlay.61

10 months ago

0.31.1-react.21

11 months ago

0.32.0

11 months ago

0.31.1-react.3

12 months ago

0.31.1-react.1

12 months ago

0.31.1-react.2

12 months ago

0.30.1-overlay.30

12 months ago

0.33.1-overlay.39

11 months ago

0.30.1-overlay.31

12 months ago

0.33.2

11 months ago

0.33.0

11 months ago

0.30.1-overlay.38

12 months ago

0.30.1-overlay.37

12 months ago

0.30.1-overlay.41

12 months ago

0.30.1-overlay.42

12 months ago

0.30.1-overlay.40

12 months ago

0.30.0

12 months ago

0.33.1-overlay.41

11 months ago

0.32.1-overlay.33

11 months ago

0.32.1-overlay.41

11 months ago

0.31.0

12 months ago

0.31.1-overlay.29

12 months ago

0.6.8-overlay.8

1 year ago

0.6.8-overlay.9

1 year ago

0.6.7

1 year ago

0.6.9

1 year ago

0.6.8

1 year ago

0.6.6-react.75

1 year ago

0.6.6

1 year ago

0.6.6-react.50

1 year ago

0.6.6-react.48

1 year ago

0.6.6-react.49

1 year ago

0.6.3-react.54

1 year ago

0.6.6-react.32

1 year ago

0.6.3

1 year ago

0.6.5

1 year ago

0.6.4

1 year ago

0.6.2

1 year ago

0.6.1

1 year ago

0.5.7-devmode.0

2 years ago

0.6.0-devmode.0

2 years ago

0.5.8-devmode2.0

2 years ago

0.5.7-devmode.7

2 years ago

0.5.8-devmode.0

2 years ago

0.5.6

2 years ago

0.5.5

2 years ago

0.5.7

2 years ago

0.6.0

2 years ago

0.5.4

2 years ago

0.5.3

2 years ago

0.5.2

2 years ago

0.5.0

2 years ago

0.5.1

2 years ago

0.4.5-express.9

2 years ago

0.4.3-express.0

2 years ago

0.4.4-express.12

2 years ago

0.4.4

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.3.1

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.1-lit-next.0

2 years ago

0.3.0

2 years ago

0.2.6-lit-next.0

3 years ago

0.2.5

3 years ago

0.2.5-lit-next.0

3 years ago

0.2.4

3 years ago

0.2.4-lit-next.0

3 years ago

0.2.3

3 years ago

0.2.3-alpha.69

3 years ago

0.2.3-alpha.40

3 years ago

0.2.3-alpha.1

3 years ago

0.2.2

3 years ago

0.2.2-alpha.59

3 years ago

0.2.2-alpha.1

3 years ago

0.2.1

3 years ago

0.2.1-alpha.14

3 years ago

0.2.1-alpha.13

3 years ago

0.2.1-alpha.12

3 years ago

0.2.1-alpha.1

3 years ago

0.2.0

3 years ago

0.1.6-alpha.27

3 years ago

0.1.6-alpha.0

3 years ago

0.1.5

3 years ago

0.1.4-alpha.26

3 years ago

0.1.4

3 years ago

0.1.4-alpha.23

3 years ago

0.1.4-alpha.21

3 years ago

0.1.4-beta.12

3 years ago

0.1.4-beta.11

3 years ago

0.1.4-beta.10

3 years ago

0.1.4-beta.16

3 years ago

0.1.4-beta.15

3 years ago

0.1.4-beta.14

3 years ago

0.1.4-beta.13

3 years ago

0.1.4-alpha.17

3 years ago

0.1.4-beta.17

3 years ago

0.1.4-alpha.12

3 years ago

0.1.4-alpha.11

3 years ago

0.1.4-alpha.9

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago