📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

@spectrum-web-components/asset

Package Overview
Dependencies
Maintainers
13
Versions
334
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spectrum-web-components/asset

Use an `<sp-asset>` element to visually represent a file, folder or image in your application. File and folder representations will center themselves horizontally and vertically in the space provided to the element. Images will be contained to the element

1.1.0
Source
npm
Version published
Weekly downloads
4.3K
21.9%
Maintainers
13
Weekly downloads
 
Created
Source

Description

Use an <sp-asset> element to visually represent a file, folder or image in your application. File and folder representations will center themselves horizontally and vertically in the space provided to the element. Images will be contained to the element, growing to the element's full height while centering itself within the width provided.

Installation

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

yarn add @spectrum-web-components/asset

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

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

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

import { Asset } from '@spectrum-web-components/asset';

Example

<sp-asset style="height: 128px">
    <img src="https://picsum.photos/500/500" alt="Demo Image" />
</sp-asset>

File

<div class="flex">
    <sp-asset variant="file"></sp-asset>
    <sp-asset variant="file" label="Named File Asset"></sp-asset>
</div>

Folder

<div class="flex">
    <sp-asset variant="folder"></sp-asset>
    <sp-asset variant="folder" label="Named Folder Asset"></sp-asset>
</div>

Keywords

spectrum css

FAQs

Package last updated on 29 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts