Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@commercetools-uikit/tag

Package Overview
Dependencies
Maintainers
3
Versions
934
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercetools-uikit/tag

A tag is often used for items that need to be labeled or categorized.

  • 0.0.0-canary-20240424172230
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8K
decreased by-66.61%
Maintainers
3
Weekly downloads
 
Created
Source

Tag

Description

A tag is often used for items that need to be labeled or categorized. This might apply to search terms or categories of a product. Tags can also have a "remove" button.

Where to use

Main Functions and use cases are:

  • Remove from a set example: Removing products from categories
  • Showing a set example: List of categories a product is in

Installation

yarn add @commercetools-uikit/tag
npm --save install @commercetools-uikit/tag

Additionally install the peer dependencies (if not present)

yarn add react react-router-dom
npm --save install react react-router-dom

Usage

import { Tag } from '@commercetools-uikit/tag';

const Example = () => (
  <Tag
    type="normal"
    isDisabled={false}
    to="/project-key/products/icecream"
    onRemove={() => {}}
  >
    Icecream
  </Tag>
);

export default Example;

Properties

PropsTypeRequiredDefaultDescription
typeunion
Possible values:
'normal' , 'warning'
'normal'Indicates color scheme of the tag.
stylesRecordStyles object that is spread into the tag body.
tounion
Possible values:
string , LocationDescriptor
Link of the tag when not disabled
isDisabledbooleanfalseDisable the tag element along with the option to remove it.
isDraggablebooleanfalseAdds the draggable icon on the left side.
onRemoveFunction
See signature.
Called when remove button is clicked.
onClickFunction
See signature.
Called when tag element is clicked. This is not called when remove button is clicked.
horizontalConstraintunion
Possible values:
, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'
'scale'Horizontal size limit of the input field.
childrenReactNodeContent rendered within the tag

Signatures

Signature onRemove

(
  event: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>
) => void

Signature onClick

(event: MouseEvent<HTMLElement>) => void

TagList

Description

A TagList component is used as wrapper for the list of tags. It has predefined spacings and flex display so that tags are grouped next to each other.

Usage

The <TagList> component accepts <Tag> element as children props. Here's an example of how to use them:

import { Tag, TagList } from '@commercetools-uikit/tag';

const Example = () => (
  <TagList>
    {['apple', 'orange'].map((tag, index) => (
      <Tag key={index}>{tag}</Tag>
    ))}
  </TagList>
);

export default Example;

Keywords

FAQs

Package last updated on 24 Apr 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc