Spaces:
Running
System.css
Browse filesA design system for building retro -inspired interfaces
Intro
System.css is a CSS library for building interfaces that resemble Apple's System OS which ran from 1984-1991. Design-wise, not much really changed from System 1 to System 6; however this library is based on System 6 as it was the final monochrome version of MacOS.
Fortunately, this library does not use any JavaScript and is compatible with any front-end framework of your choice. Most styles can also be overwritten to allow for deeper customization.
Components
Buttons
A button is a rounded rectangle that is named with text. Clicking a button performs the action described by the button's name.
— Apple HI Guidelines, p. 204
A standard button measures 59px wide and 20px tall. We use the .btn class for these buttons
Cancel Submit
Show code
<button class="btn">Cancel</button>
<button class="btn">Submit</button>
When pressed, buttons invert. The button below is stimulated to be in the active state.
Active
Show code
<button >Active</button>
Buttons can also have dynamic widths.
Buttons can be long!!
Show code
Or even have a default choice.
Cancel Find
Show code
<button class="btn">Cancel</button>
<button class="btn btn-default">Find</button>
Disabled buttons look the same as standard buttons, but with grey button text. Add the disabled attribute to use it.
Disabled
Show code
<button class="btn" disabled>Disabled</button>
Radio Buttons
A radio button is a Macintosh control that displays a setting, either on or off, and is part of a group in which only one button can be on at a time.
— Apple HI Guidelines, p. 210
Radio Buttons can be rendered by specifying a radio type on an input tag and assigning it a name.
Left
Center
Right
Show code
<div class="field-row">
<input id="radio1" type="radio" name="first-example">
<label for="radio1">Left</label>
</div>
<div class="field-row">
<input id="radio2" type="radio" name="first-example">
<label for="radio2">Center</label>
</div>
<div class="field-row">
<input id="radio3" type="radio" name="first-example">
<label for="radio3">Right</label>
</div>
Checkboxes
Checkboxes, like radio buttons, provide alternative choices for users. A checkbox is a square with label text next to it
— Apple HI Guidelines, p. 211
Checkboxes can be rendered by specifying a checkbox type on an input tag and assigning it a name.
Left
Center
Right
Show code
<div class="field-row">
<input id="checkbox1" type="checkbox" name="chbx-example">
<label for="checkbox1">Left</label>
</div>
<div class="field-row">
<input id="checkbox2" type="checkbox" name="chbx-example">
<label for="checkbox2">Center</label>
</div>
<div class="field-row">
<input id="checkbox3" type="checkbox" name="chbx-example">
<label for="checkbox3">Right</label>
</div>
Menu Bar
The menu bar extends across the top of the screen and contains words and icons that serve as the title of each menu
— Apple HI Guidelines, p. 52
A menu bar consists of menu elements that name menu items and they typically have a dropdown menu associated with them.
To create a menu bar we will use the .menu-bar class.
File
Edit
View
Special
Show code
<ul role="menu-bar">
<li role="menu-item" tabindex="0" aria-haspopup="true">
File
<ul role="menu">
<li role="menu-item"><a href="#menu">Action</a></li>
<li role="menu-item"><a href="#menu">Another Action</a></li>
<li role="menu-item" class="divider"><a href="#menu">Something else here</a></li>
<li role="menu-item"><a href="https://twitter.com/sakofchit">sakun's twitter</a></li>
</ul>
</li>
<li role="menu-item" tabindex="0" aria-haspopup="true">
Edit
<ul role="menu">
<li role="menu-item"><a href="#menu">Action</a></li>
<li role="menu-item"><a href="#menu">Another Action</a></li>
<li role="menu-item" class="divider"><a href="#menu">Something else here</a></li>
<li role="menu-item"><a href="https://sakun.co">sakun's projects</a></li>
</ul>
</li>
<li role="menu-item" tabindex="0" aria-haspopup="true">
View
<ul role="menu">
<li role="menu-item"><a href="#menu">Action</a></li>
<li role="menu-item"><a href="#menu">Another Action</a></li>
<li role="menu-item"><a href="#menu">Something else here</a></li>
</ul>
</li>
<li role="menu-item" tabindex="0" aria-haspopup="true">
Special
<ul role="menu">
<li role="menu-item"><a href="#menu">You</a></li>
<li role="menu-item"><a href="#menu">Get the</a></li>
<li role="menu-item"><a href="#menu">Idea</a></li>
</ul>
</li>
</ul>
In case of a menu item as a single children or plain text with no menu dropdown associated with it, use aria-haspopup="false" attribute.
Single Item
System.css on GitHub
Show code
<ul role="menu-bar">
<li role="menu-item" tabindex="0" aria-haspopup="false">Single Item</li>
<li role="menu-item" tabindex="0" aria-haspopup="false"><a target="_blank" href="https://github.com/sakofchit/system.css">System.css on GitHub</a></li>
</ul>
We can also manipulate a menu bar into a standard dropdown.
Dropdown
Show code
<ul role="menu-bar">
<li role="menu-item" tabindex="0" aria-haspopup="true">
Dropdown
<ul role="menu">
<li role="menu-item"><a href="#menu">Action</a></li>
<li role="menu-item"><a href="#menu">Another Action</a></li>
<li role="menu-item" class="divider"><a href="#menu">Something else here</a></li>
<li role="menu-item"><a href="https://twitter.com/sakofchit">sakun's twitter</a></li>
</ul>
</li>
</ul>
Select Menu
A select menu can be used to create a drop-down list, typically used in forms.
Select menus can be rendered using the select and option elements.
name
Show code
<select>
<option>name</option>
<option>age</option>
<option>date of birth</option>
</select>
By default the first option will be selected, but you can change that by adding the selected attribute to an option
date of birth
Show code
<select>
<option>name</option>
<option>age</option>
<option selected>date of birth</option>
</select>
Text Box
The place or places in a dialog box where information can be typed. Also called text entry field.
— Apple HI Guidelines, p. 372
Text Boxes can be rendered by specifying a text type on an input tag
some cool text
Show code
<input aria-label="Example text box" type="text" placeholder="some cool text"/>
Other types of text are also supported
Email
panic@thedis.co
Password
password
Show code
<form>
<label for="text_email">Email</label><br>
<input id="text_email" type="email" placeholder="panic@thedis.co"/><br>
<label for="text_pwd">Password</label><br>
<input id="text_pwd" type="password" placeholder="password"/><br><br>
</form>
Windows
Standard document windows have standard structural components. These components include the title bar, size box, close box, zoom box, and scroll bars. Windows are designed for visual consistency across all monitors
— Apple HI Guidelines, p. 134, 159
Title Bar
A standard title bar is at least 19px tall, has a close button, caption, and racing stripes.
They're usually a part of a window. Title bars use the Chicago 12pt font.
A Title Bar
Show code
<div class="window">
<div class="title-bar">
<button aria-label="Close" class="close"></button>
<h1 class="title">A Title Bar</h1>
<button aria-label="Resize" disabled class="hidden"></button>
</div>
</div>
Title bars can look different depending on what they're intended for.
Also a Title Bar
Dialog Title
Show code
<div class="window">
<div class="title-bar">
<button aria-label="Close" class="close"></button>
<h1 class="title">Also a Title Bar</h1>
<button aria-label="Resize" class="resize"></button>
</div>
</div>
<div class="window">
<div class="title-bar">
<h1 class="title">Dialog Title</h1>
</div>
</div>
You can also set a title bar to be inactive by applying the .inactive-title-bar class
Inactive Title Bar
Show code
<div class="window">
<div class="inactive-title-bar">
<h1 class="title">Inactive Title Bar</h1>
</div>
</div>
Window Contents
Document windows present a view into the content that people create and store.
— Apple HI Guidelines, p. 134
This is a window (without stuff in it). To create a basic window, we simply use the .window class.
Window Without Stuff
Show code
<div class="window scale-down">
<div class="title-bar">
<button aria-label="Close" class="close"></button>
<h1 class="title">Window Without Stuff</h1>
<button aria-label="Resize" class="resize"></button>
</div>
</div>
This is a window with stuff in it. We can achieve this by simply adding a div with the .window-pane below the title bar.
Window With Stuff
Woo I got stuff in me!
Show code
<div class="window">
<div class="title-bar">
<button aria-label="Close" class="close"></button>
<h1 class="title">Window With Stuff</h1>
<button aria-label="Resize" class="resize"></button>
</div>
<div class="separator"></div>
<div class="window-pane">
Woo I got stuff in me!
</div>
</div>
You can also add a details bar to a window by adding.details-bar below the title bar.
Window With Details
some
more
details
Woo I got a details bar.
Show code
<div class="window">
<div class="title-bar">
<button aria-label="Close" class="close"></button>
<h1 class="title">Window With Details</h1>
<button aria-label="Resize" class="resize"></button>
</div>
<div class="details-bar">
<span>some</span>
<span>more</span>
<span>details</span>
</div>
<div class="window-pane">
Woo I got a details bar.
</div>
</div>
You can also create an inactive window using an inactive title bar.
Inactive Window
some
more
details
not active :(
Show code
<div class="window">
<div class="inactive-title-bar">
<h1 class="title">Inactive Window</h1>
</div>
<div class="details-bar">
<span>some</span>
<span>more</span>
<span>details</span>
</div>
<div class="window-pane">
not active :(
</div>
</div>
Dialogs
Dialog boxes are windows that provide a standard framework in which the computer can present alternatives from which the user can choose.
— Apple HI Guideli
- components/system-menu.js +81 -0
- style.css +23 -5
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class SystemMenu extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
.menu-bar {
|
| 7 |
+
display: flex;
|
| 8 |
+
list-style: none;
|
| 9 |
+
padding: 0;
|
| 10 |
+
margin: 0;
|
| 11 |
+
background: #dfdfdf;
|
| 12 |
+
border-bottom: 1px solid #808080;
|
| 13 |
+
font-family: Chicago, Geneva, sans-serif;
|
| 14 |
+
font-size: 12px;
|
| 15 |
+
}
|
| 16 |
+
.menu-item {
|
| 17 |
+
padding: 2px 10px;
|
| 18 |
+
position: relative;
|
| 19 |
+
cursor: default;
|
| 20 |
+
}
|
| 21 |
+
.menu-item:hover {
|
| 22 |
+
background: #0a0a0a;
|
| 23 |
+
color: white;
|
| 24 |
+
}
|
| 25 |
+
.menu {
|
| 26 |
+
display: none;
|
| 27 |
+
position: absolute;
|
| 28 |
+
left: 0;
|
| 29 |
+
top: 100%;
|
| 30 |
+
background: white;
|
| 31 |
+
border: 1px solid #0a0a0a;
|
| 32 |
+
box-shadow: 1px 1px 0 0px #dfdfdf;
|
| 33 |
+
min-width: 120px;
|
| 34 |
+
padding: 2px 0;
|
| 35 |
+
z-index: 1000;
|
| 36 |
+
}
|
| 37 |
+
.menu-item:hover .menu {
|
| 38 |
+
display: block;
|
| 39 |
+
}
|
| 40 |
+
.menu a {
|
| 41 |
+
display: block;
|
| 42 |
+
padding: 4px 20px;
|
| 43 |
+
color: black;
|
| 44 |
+
text-decoration: none;
|
| 45 |
+
}
|
| 46 |
+
.menu a:hover {
|
| 47 |
+
color: white;
|
| 48 |
+
background: #0a0a0a;
|
| 49 |
+
}
|
| 50 |
+
.divider {
|
| 51 |
+
border-top: 1px solid #808080;
|
| 52 |
+
margin: 2px 0;
|
| 53 |
+
}
|
| 54 |
+
</style>
|
| 55 |
+
<ul class="menu-bar" role="menu-bar">
|
| 56 |
+
<li class="menu-item" role="menu-item" tabindex="0" aria-haspopup="true">
|
| 57 |
+
File
|
| 58 |
+
<ul class="menu" role="menu">
|
| 59 |
+
<li role="menu-item"><a href="#">New</a></li>
|
| 60 |
+
<li role="menu-item"><a href="#">Open</a></li>
|
| 61 |
+
<li class="divider" role="menu-item"><a href="#">Close</a></li>
|
| 62 |
+
<li role="menu-item"><a href="#">Quit</a></li>
|
| 63 |
+
</ul>
|
| 64 |
+
</li>
|
| 65 |
+
<li class="menu-item" role="menu-item" tabindex="0" aria-haspopup="true">
|
| 66 |
+
Edit
|
| 67 |
+
<ul class="menu" role="menu">
|
| 68 |
+
<li role="menu-item"><a href="#">Undo</a></li>
|
| 69 |
+
<li role="menu-item"><a href="#">Cut</a></li>
|
| 70 |
+
<li role="menu-item"><a href="#">Copy</a></li>
|
| 71 |
+
<li role="menu-item"><a href="#">Paste</a></li>
|
| 72 |
+
</ul>
|
| 73 |
+
</li>
|
| 74 |
+
<li class="menu-item" role="menu-item" tabindex="0" aria-haspopup="false">
|
| 75 |
+
<a target="_blank" href="https://github.com/sakofchit/system.css">Help</a>
|
| 76 |
+
</li>
|
| 77 |
+
</ul>
|
| 78 |
+
`;
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
customElements.define('system-menu', SystemMenu);
|
|
@@ -1,20 +1,38 @@
|
|
| 1 |
|
| 2 |
/* Base Styles */
|
| 3 |
body {
|
| 4 |
-
font-family: -apple-system, BlinkMacSystemFont, "
|
| 5 |
margin: 0;
|
| 6 |
padding: 0;
|
| 7 |
color: #000;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
}
|
| 9 |
-
|
| 10 |
/* Layout */
|
| 11 |
.container {
|
| 12 |
width: 90%;
|
| 13 |
-
max-width:
|
| 14 |
-
margin:
|
| 15 |
-
padding:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
/* Typography */
|
| 19 |
h1, h2, h3 {
|
| 20 |
font-family: 'Chicago', sans-serif;
|
|
|
|
| 1 |
|
| 2 |
/* Base Styles */
|
| 3 |
body {
|
| 4 |
+
font-family: -apple-system, BlinkMacSystemFont, "Chicago", "Geneva", sans-serif;
|
| 5 |
margin: 0;
|
| 6 |
padding: 0;
|
| 7 |
color: #000;
|
| 8 |
+
background-color: #C0C0C0;
|
| 9 |
+
background-image: url('http://static.photos/retro/640x360/42');
|
| 10 |
+
background-size: cover;
|
| 11 |
+
background-attachment: fixed;
|
| 12 |
}
|
|
|
|
| 13 |
/* Layout */
|
| 14 |
.container {
|
| 15 |
width: 90%;
|
| 16 |
+
max-width: 800px;
|
| 17 |
+
margin: 2rem auto;
|
| 18 |
+
padding: 2px;
|
| 19 |
+
background: white;
|
| 20 |
+
box-shadow:
|
| 21 |
+
inset -1px -1px 0 0px #0a0a0a,
|
| 22 |
+
inset 1px 1px 0 0px #dfdfdf,
|
| 23 |
+
inset -2px -2px 0 0px #808080,
|
| 24 |
+
inset 2px 2px 0 0px #ffffff;
|
| 25 |
}
|
| 26 |
|
| 27 |
+
.window {
|
| 28 |
+
margin: 1rem 0;
|
| 29 |
+
background: white;
|
| 30 |
+
box-shadow:
|
| 31 |
+
inset -1px -1px 0 0px #0a0a0a,
|
| 32 |
+
inset 1px 1px 0 0px #dfdfdf,
|
| 33 |
+
inset -2px -2px 0 0px #808080,
|
| 34 |
+
inset 2px 2px 0 0px #ffffff;
|
| 35 |
+
}
|
| 36 |
/* Typography */
|
| 37 |
h1, h2, h3 {
|
| 38 |
font-family: 'Chicago', sans-serif;
|