Sticker

Stickers are a visual way to quickly identify content in a different way than badges and labels.

installyarn add @clayui/sticker
versionNPM Version
useimport Sticker from '@clayui/sticker';

Display Type

Stickers can be any color. Set sticker’s color using displayType property.

Also, you can use the following sizes on your Sticker just setting up size:

import {Provider} from '@clayui/core';
import Sticker from '@clayui/sticker';
import Icon from '@clayui/icon';
import React from 'react';

import '@clayui/css/lib/css/atlas.css';

export default function App() {
	return (
		<Provider spritemap="/public/icons.svg">
			<div className="p-4">
				<>
					<Sticker displayType="danger" size="sm">
						<Icon symbol="user" />
					</Sticker>

					<Sticker displayType="dark" size="md">
						<Icon symbol="user" />
					</Sticker>

					<Sticker displayType="info" size="lg">
						<Icon symbol="user" />
					</Sticker>

					<Sticker displayType="light" size="xl">
						<Icon symbol="user" />
					</Sticker>

					<Sticker displayType="secondary" size="xl">
						<Icon symbol="user" />
					</Sticker>

					<Sticker displayType="success" size="lg">
						<Icon symbol="user" />
					</Sticker>

					<Sticker displayType="unstyled" size="md">
						<Icon symbol="user" />
					</Sticker>

					<Sticker displayType="warning" size="sm">
						<Icon symbol="user" />
					</Sticker>
				</>
			</div>
		</Provider>
	);
}

User Icon

Use a Sticker as User Icon just adding sticker-user-icon on className of the Sticker component like the example below:

import {Provider} from '@clayui/core';
import Sticker from '@clayui/sticker';
import React from 'react';

import '@clayui/css/lib/css/atlas.css';

export default function App() {
	return (
		<Provider spritemap="/public/icons.svg">
			<div className="p-4">
				<>
					<Sticker userIcon size="xl">
						<Sticker.Image
							alt="placeholder"
							src="https://clayui.com/images/long_user_image.png"
						/>
					</Sticker>

					<Sticker userIcon size="xl">
						BS
					</Sticker>
				</>
			</div>
		</Provider>
	);
}

Positioning

You can set a desired alignment of sticker according to a parent element, just setting up the position property. If you want to set the position of the sticker on the outside corners, use outside property in conjunction with position property.

Overlay content over stickers by nesting sticker-overlay elements as children of Sticker. Check our example on Storybook