Build a small design system
Build a Button and Card library in the desktop app, then use it in a second document with light and dark themes.
Download the example files to inspect the finished library and design. Extract both files into the same folder.
Define the variables
Create a new file and save it as starter.pen in an empty folder. Open
Variables in the toolbar and add these variables:
| Name | Type | Value |
|---|---|---|
surface | Color | #FFFFFF |
ink | Color | #18181B |
accent | Color | #2563EB |
space | Number | 16 |
font-body | String | Inter |
font-size | Number | 16 |
Use + beside the column headings to add a theme value. Rename the columns
Light and Dark. Set surface to #18181B and ink to #FAFAFA in
Dark. Keep the other values the same in both columns.
Create the components
- Create a frame named Button, 144 pixels wide and 48 pixels tall
- Add a text layer named Label with the text Continue and a white fill
- Set the frame’s flex alignment to center the label horizontally and vertically
- Apply
accentto the frame’s fill, andfont-bodyandfont-sizeto the label - Select the frame and click Create Component
Create a second frame named Card, 360 pixels wide, with vertical flex
layout and Hug Height. Apply surface to its fill and space to its gap
and padding. Add two text layers:
- Title: Your next step, using Inter at 24 pixels and
inkfor its fill - Detail: Choose an action below., using
font-body,font-size, andink
Turn Card into a component. Add an empty frame named Actions inside it, 48 pixels tall with Fill Width. Select Actions, click Make slot, and use + beside Slot to suggest Button.
Save the file. Open Libraries and choose Turn this file into a library.
The resulting file is starter.lib.pen.
Use the library
- Create a second document and save it as
consumer.penin the same folder - Open Libraries, click + beside No imported libraries, and select
starter.lib.pen - Open Components and click Card to insert an instance
- Select its Actions slot and click Button under Slot in the properties panel
- Change the instance’s Title to Ready to continue and its button label to Save
- Copy and paste the Card instance, then select the copy and choose Theme → Add theme → Theme, followed by Dark
The second Card has a dark background and light text. Both instances keep their custom text. Save the document.
Update the source
Open starter.lib.pen. In both theme columns, change accent to #7C3AED
and font-size to 18.
Save it, then close and reopen consumer.pen. Both buttons turn purple and
their labels grow. The labels still read Save because you overrode their text.
Keep both .pen files together when moving this design. If the consumer reports
a missing library, open Libraries, click the missing entry, and use
Locate to select starter.lib.pen in its new location.
Save the consumer after reconnecting the library.
This example uses Inter from the font picker and has no image files. For designs with imported fonts or images, follow the copying and resource guidance.