https://github.com/RoleModel/optics
Optics, a RoleModel Design System is a CSS package that provides base styles and components that can be integrated and customized in a variety of projects.
https://github.com/RoleModel/optics
css design design-system design-systems optics storybook
Last synced: 11 months ago
JSON representation
Optics, a RoleModel Design System is a CSS package that provides base styles and components that can be integrated and customized in a variety of projects.
- Host: GitHub
- URL: https://github.com/RoleModel/optics
- Owner: RoleModel
- License: mit
- Created: 2022-03-09T19:58:26.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-05-12T22:57:52.000Z (about 1 year ago)
- Last Synced: 2025-06-13T09:58:50.185Z (12 months ago)
- Topics: css, design, design-system, design-systems, optics, storybook
- Language: CSS
- Homepage: https://docs.optics.rolemodel.design
- Size: 16.9 MB
- Stars: 15
- Watchers: 7
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Optics, a RoleModel Design System
[](https://github.com/RoleModel/optics)
[](https://github.com/RoleModel/optics/blob/main/LICENSE)
[](https://www.npmjs.com/package/@rolemodel/optics)
[](https://github.com/RoleModel/optics/actions/workflows/linting.yml)
Optics is a css package that provides base styles and components that can be integrated and customized in a variety of projects.
## Installation
### NPM
```sh
npm install @rolemodel/optics
```
### Yarn
```sh
yarn add @rolemodel/optics
```
### Importing with a compiler
You can add this import to the top of your root level `css` file.
```css
@import '@rolemodel/optics'; /* Using webpack to compile */
/* Or */
@import '@rolemodel/optics/dist/css/optics'; /* Using a different compiler */
/* Or */
@import '@rolemodel/optics/dist/css/optics.min.css'; /* If you want a single file with all the styles in it. */
```
### Importing without a compiler
To use Optics without compilation, use a CDN like [jsDelivr](https://www.jsdelivr.com/) or [unpkg](https://unpkg.com/).
Add a link in your HTML head or an `@import` to the top of your root level `css` file.
```html
```
```css
@import 'https://cdn.jsdelivr.net/npm/@rolemodel/optics@[desired version]/dist/css/optics.min.css';
```
Note: You can use this method to use Optics with [CodePen](https://codepen.io/). In a CodePen project, go to `Settings > CSS`, find the section for adding external stylesheets, and add the CDN link as a resource.
## Documentation
We use [Storybook](https://storybook.js.org/docs/html/get-started/introduction) as a way to provide informative and interactive documentation.
It can be found here [Optics Documentation](https://docs.optics.rolemodel.design/)
### Token Documentation
We use the Storybook Design Token for showing design tokens in the documentation. This allows us to tag groups of tokens with a category and a presenter.
[Available Presenters](https://github.com/UX-and-I/storybook-design-token#available-presenters)
Add the following above a group to categorize the tokens.
```css
/**
* @tokens Basic Colors
* @presenter Color
*/
```
### Component Documentation
For instructions on how to create a new component, see [Process for Creating New Components](./NEW_COMPONENT.md)
Additional stories can be added using the following command, or copying an existing story.
```sh
npm run generate
```
The visual graphic found on the Selective Imports page in the documentation is generated from the `tools/generate-graph.dot` file. You can preview and export a newer svg version of the graphic by using the `tintinweb.graphviz-interactive-preview` VSCode extension.
## License
[MIT](LICENSE)