@carbon/utilities
v0.26.0
Published
Utilities and helpers to drive consistency across software products using the Carbon Design System
Downloads
582,142
Readme
@carbon/utilities
Utilities and helpers to drive consistency across software products using the Carbon Design System
Getting started
To install @carbon/utilities in your project, you will need to run the
following command using npm:
npm install @carbon/utilitiesIf you prefer Yarn, use the following command instead:
yarn add @carbon/utilitiesMaintainer information
This package uses a convention-based multi-entry build. The supported public API consists of two parts.
- The root entrypoint
import { utility } from '@carbon/utilities';- Any top-level module with a
src/<name>/index.tsfile
import { utility } from '@carbon/utilities/utility';Review the architecture decision record (ADR) for more detail on how and why this approach is used.
Internal modules
Some directories under src/ are marked as internal and are NOT exported from
the package root or as public entrypoints. These modules are intended for use
only by other Carbon packages (e.g., @carbon/react, @carbon/web-components)
and should not be used by external consumers.
Internal modules:
src/date-picker/- Shared date picker primitives for React and Web Components
To use internal modules within Carbon packages:
import { utility } from '@carbon/utilities/src/internal-module';Note: Internal modules are not part of the public API and may change without notice. External consumers should not depend on these modules.
Adding a utility
- Create a new top-level directory under
src/ - Export the public API for that utility from
src/<name>/index.ts - Re-export it from
src/index.tsif it should also be available from the package root - Build the package and verify the generated outputs under
es/<name>/index.*andlib/<name>/index.js
src/
someUtility/
index.ts
someUtility.ts🙌 Contributing
We're always looking for contributors to help us fix bugs, build new features, or help us improve the project documentation. If you're interested, definitely check out our Contributing Guide! 👀
📝 License
Licensed under the Apache 2.0 License.
IBM Telemetry
This package uses IBM Telemetry to collect de-identified and anonymized metrics data. By installing this package as a dependency you are agreeing to telemetry collection. To opt out, see Opting out of IBM Telemetry data collection. For more information on the data being collected, please see the IBM Telemetry documentation.
