Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@atlaskit/icon
Advanced tools
@atlaskit/icon is a package from Atlassian's Atlaskit design system that provides a collection of icons for use in React applications. It offers a variety of icons that can be easily integrated and customized within your projects.
Basic Icon Usage
This feature allows you to import and use a specific icon from the @atlaskit/icon package. The example demonstrates how to use the AtlassianIcon with a medium size.
import { AtlassianIcon } from '@atlaskit/icon';
const MyComponent = () => (
<div>
<AtlassianIcon size="medium" />
</div>
);
Customizing Icon Size
This feature allows you to customize the size of the icon. The example shows how to set the size of the AtlassianIcon to large.
import { AtlassianIcon } from '@atlaskit/icon';
const MyComponent = () => (
<div>
<AtlassianIcon size="large" />
</div>
);
Using Different Icons
This feature demonstrates how to use different icons from the @atlaskit/icon package. The example shows the usage of BitbucketIcon and JiraIcon with medium size.
import { BitbucketIcon, JiraIcon } from '@atlaskit/icon';
const MyComponent = () => (
<div>
<BitbucketIcon size="medium" />
<JiraIcon size="medium" />
</div>
);
react-icons is a popular package that provides a wide range of icons from various icon libraries such as Font Awesome, Material Design, and more. It offers a similar functionality to @atlaskit/icon but with a broader selection of icons from different sources.
fontawesome is a widely-used icon library that offers a vast collection of icons. It provides both free and pro versions, with the pro version offering additional icons and features. Font Awesome icons can be used in various frameworks and libraries, including React.
!!IMPORTANT
The icons package has a custom build process, as it generates its both stripped svgs and glyphs that are committed to the repo, so that they can be accessed as paths when published.
You will manually need to run yarn build:icon
from the root repository, or
yarn build
from inside the icon folder whenever you make changes to icon.
This package contains the Atlaskit icons. All icons should be consumed separately unless your build tool supports tree shaking.
This packages is licensed under the Atlassian Design Guidelines - please check the LICENSE file for more information.
npm install @atlaskit/icon
The @atlaskit/icon
package exports the Icon React components.
Import the component in your React app as follows:
import AkIconHome from '@atlaskit/icon/glyph/home';
ReactDOM.render(<AkIconHome />, container);
You can control the icon color via CSS:
<span style={{color: 'red'}}>
<AkIconHome />
</span>
This package provides all icons bundled in one export but unless your build tool supports tree shaking, you should import only a single icon instead of the bundled version.
import * as icons from '@atlaskit/icon';
const { BitbucketLogo } = icons;
ReactDOM.render(<BitbucketLogo />, container);
Importing a single icon (this will still bundle all of the icons in your final bundle if you don't use tree shaking):
import BitbucketLogo from '@atlaskit/icon';
ReactDOM.render(<BitbucketLogo />, container);
Adding new icons is as simple as checking out the Atlaskit repo, adding your SVG
file to /packages/elements/icon/utils/raw_svgs
and running yarn update
from
within the packages/elements/icon
directory.
NOTE: The reduced-ui-pack
package should contain all the icons we include
in this package. Make sure to rebuild the reduced-ui-pack
sprite as outlined in
the README.md file included within that package.
Some things to look for:
/icon/src/icons/subfolder
and it will be namespaced appropriately.All icons
story. Look for any clipping or
sizing issues here.All icons (usage)
story to make sure the naming has worked as
expected (paths/namespacing makes sense, etc).Icons with broken fills (solid parts)
story to make sure that no
parts of your svg have hardcoded colors.
fill="XXXXX"
and replace them with fill="currentColor"
.Icons that are too big (red parts)
story to show any parts of the
icon that fall outside the 24x24 size that icons should fill.icon/test/indexSpec.jsx
to include your
icon.Kind: global class
Properties
string
size
function
Icon interface. All icons follow this structure.
string
(Required) The icon label This is a required attribute. Omitting it will make the icon inaccessible for screen readers, etc.. The text passed will be sanitized, e.g. passed HTML will be represented as plain text.
Kind: instance property of Icon
(Optional) An icon size.
Defaults to an empty string (which means it uses the default size).
Kind: instance property of Icon
Default:
small
function
(Optional) A handler to execute when the icon is clicked.
Defaults to a noop.
Kind: instance property of Icon
enum
Icon size values.
Kind: global enum Properties
Name | Type | Default | Description |
---|---|---|---|
small | string | "small" | small icon |
medium | string | "medium" | medium icon |
large | string | "large" | large icon |
xlarge | string | "xlarge" | xlarge icon |
FAQs
An icon is a symbol representing a command, device, directory, or common action.
The npm package @atlaskit/icon receives a total of 108,916 weekly downloads. As such, @atlaskit/icon popularity was classified as popular.
We found that @atlaskit/icon demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.