Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@chakra-ui/tag
Advanced tools
This component displays as a tag with an optional link and/or button to remove the given tag.
@chakra-ui/tag is a component library from Chakra UI that provides a set of accessible, customizable, and reusable tag components for React applications. These tags can be used to display labels, categories, or any other type of information that needs to be highlighted or categorized.
Basic Tag
This feature allows you to create a basic tag component that can be used to display simple labels or categories.
import { Tag } from '@chakra-ui/react';
function BasicTag() {
return <Tag>Sample Tag</Tag>;
}
Tag with Color Scheme
This feature allows you to create a tag with a specific color scheme, making it easy to differentiate between different types of tags.
import { Tag } from '@chakra-ui/react';
function ColoredTag() {
return <Tag colorScheme='green'>Green Tag</Tag>;
}
Tag with Icon
This feature allows you to add an icon to your tag, providing a visual cue to the user about the tag's purpose or category.
import { Tag, TagLabel, TagLeftIcon } from '@chakra-ui/react';
import { CheckIcon } from '@chakra-ui/icons';
function TagWithIcon() {
return (
<Tag>
<TagLeftIcon boxSize='12px' as={CheckIcon} />
<TagLabel>Tag with Icon</TagLabel>
</Tag>
);
}
Closable Tag
This feature allows you to create a tag that can be closed or removed by the user, providing a way to manage tags dynamically.
import { Tag, TagLabel, TagCloseButton } from '@chakra-ui/react';
function ClosableTag() {
return (
<Tag>
<TagLabel>Closable Tag</TagLabel>
<TagCloseButton />
</Tag>
);
}
react-tag-input is a popular package for creating and managing tags in React applications. It provides a flexible and customizable tag input component, but it may not offer the same level of accessibility and design consistency as @chakra-ui/tag.
react-tags is another package for creating tag input fields in React. It offers a simple and straightforward API for adding and removing tags, but it lacks the built-in styling and accessibility features provided by @chakra-ui/tag.
react-tag-autocomplete is a package that combines tag input functionality with autocomplete suggestions. It is useful for applications that require users to select tags from a predefined list, but it may not be as customizable or accessible as @chakra-ui/tag.
This component is displayed as an accessible tag with an optional link and/or button to remove it.
yarn add @chakra-ui/tag
import { Tag } from "@chakra-ui/tag"
<Tag />
Pass the size
prop to change the size of the tag.
<>
<Tag size="sm" colorScheme="gray">
Gray
</Tag>
<Tag colorScheme="gray">Gray</Tag>
<Tag size="lg" colorScheme="gray">
Gray
</Tag>
</>
Pass the colorScheme
prop to change the background color of the tag component
<>
<Tag colorScheme="pink">Pink</Tag>
</>
The tag component can contain an Icon. This is done by using the TagIcon
component within the tag component.
<>
<Tag colorScheme="cyan">
<TagIcon size="12px" as={AddIcon} />
<TagLabel>Green</TagLabel>
</Tag>
</>
Use the TagCloseButton
to apply a close button to the tag component.
<Tag variant="solid" size="sm" colorScheme="cyan">
<TagLabel>Tab Label</TagLabel>
<TagCloseButton />
</Tag>
Tag component can contain a custom element. This is done by placing the custom element within the tag component.
<Tag size="lg" colorScheme="red" borderRadius="full">
<Avatar
src="https://bit.ly/sage-adebayo"
size="xs"
name="Segun Adebayo"
ml={-1}
mr={2}
/>
<TagLabel>Segun</TagLabel>
<TagCloseButton />
</Tag>
FAQs
This component displays as a tag with an optional link and/or button to remove the given tag.
We found that @chakra-ui/tag demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.