An image that can be be enlarged to view in full detail using the Lightbox.
userTestingNext
theme.
<tk-expandable-image
image-uri="/images/expandable-image/kitten-tiny.png"
description="kitten-tiny.png"
image-alt="Picture of a kitten"
focus-text="Expand image"
>
</tk-expandable-image>
<hr class="horizontal-rule">
<tk-expandable-image
image-uri="/images/expandable-image/kitten-portrait.png"
description="kitten-portrait.png"
image-alt="Picture of a kitten"
focus-text="Expand image"
>
</tk-expandable-image>
<hr class="horizontal-rule">
<tk-expandable-image
image-uri="/images/expandable-image/kitten-smaller.png"
description="Sample-Image.png"
image-alt="Picture of a kitten"
focus-text="Expand image"
></tk-expandable-image>
<hr class="horizontal-rule">
<tk-expandable-image
image-uri="/images/expandable-image/kitten.png"
description="Sample-Image.png"
image-alt="Picture of a kitten"
focus-text="Expand image"
></tk-expandable-image>
Provide the image-alt
attribute to enable screen readers to read information about the image.
<tk-expandable-image
image-uri="/images/expandable-image/kitten.png"
description="Sample-Image.png"
image-alt="Picture of a kitten"
focus-text="Expand image"
>
<tk-expandable-image-controls>
<tk-expandable-image-control>
<tk-icon-button type="outline" label="Expand image">
<tk-icon name="move"></tk-icon>
</tk-icon-button>
<tk-tooltip position="left">Expand image</tk-tooltip>
</tk-expandable-image-control>
<tk-expandable-image-control>
<tk-icon-button type="outline" label="Delete this file">
<tk-icon name="delete"></tk-icon>
</tk-icon-button>
<tk-tooltip position="left">Delete this file</tk-tooltip>
</tk-expandable-image-control>
</tk-expandable-image-controls>
</tk-expandable-image>
<hr class="horizontal-rule">
<tk-expandable-image
image-uri="/images/expandable-image/kitten.png"
description="Sample-Image.png"
image-alt="Picture of a kitten"
focus-text="Expand image"
>
<tk-expandable-image-controls>
<tk-expandable-image-control>
<tk-icon-button type="outline" label="Expand image">
<tk-icon name="move"></tk-icon>
</tk-icon-button>
<tk-tooltip position="left">Expand image</tk-tooltip>
</tk-expandable-image-control>
<tk-expandable-image-control>
<tk-icon-button type="outline" status="disabled" label="Delete this file">
<tk-icon name="delete"></tk-icon>
</tk-icon-button>
</tk-expandable-image-control>
</tk-expandable-image-controls>
</tk-expandable-image>
A tk-expandable-image-control
consists of an icon button and a tooltip. Make sure to render a label on the button. Sse the status
attribute on tk-icon-button
to render a button as disabled.
<tk-expandable-image
image-uri="/images/expandable-image/kitten.png"
description="Sample-Image.png"
image-alt="Picture of a kitten"
focus-text="Expand image"
max-width="600"
></tk-expandable-image>
Use this prop to render the image wider than the default max-width
of 462px
. Height will scale according to the ratio established in the image.
<!-- for demo only -->
<tk-highlight
style="display: block;"
id="tkHighlight"
></tk-highlight>
<tk-expandable-image
id="exampleExpandableImage"
image-uri="/images/expandable-image/kitten.png"
description="Sample-Image.png"
image-alt="Picture of a kitten"
focus-text="Expand image"
>
<tk-expandable-image-controls>
<tk-expandable-image-control>
<tk-icon-button type="outline" label="Expand image">
<tk-icon name="move"></tk-icon>
</tk-icon-button>
<tk-tooltip position="left">Expand image</tk-tooltip>
</tk-expandable-image-control>
<tk-expandable-image-control>
<tk-icon-button type="outline" label="Delete this file">
<tk-icon name="delete"></tk-icon>
</tk-icon-button>
<tk-tooltip position="left">Delete this file</tk-tooltip>
</tk-expandable-image-control>
</tk-expandable-image-controls>
</tk-expandable-image>
This is a vanilla JS example. When using a framework like Angular or React you would code the respective equivalent.
<tk-expandable-image
image-uri="/images/expandable-image/kitten.png"
description="Sample-Image.png"
image-alt="Picture of a kitten"
focus-text="Expand image"
read-only
></tk-expandable-image>
To disable interaction with the component, pass the read-only
prop.
Property | Attribute | Description | Type | Default |
---|---|---|---|---|
description |
description |
The optional description to render below the image. | string |
undefined |
focusText |
focus-text |
The text to show when the component is focused. This should give an accurate description of what will happen when a user chooses to click the component. | string |
undefined |
imageAlt |
image-alt |
The value of the alt attribute that the image should use. | string |
undefined |
imageUri |
image-uri |
The uri of the image that should be loaded. | string |
undefined |
maxWidth |
max-width |
Allows you to pass a maxWidth to customise the default of 462px. | number |
undefined |
readOnly |
read-only |
Renders the component in read-only mode. Interaction will be disabled. | boolean |
false |