[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

System.css

A 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

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.

Show code
<button >Active</button>

Buttons can also have dynamic widths.

Show code
<button class="btn">Buttons can be long!!</button>

Or even have a default choice.

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.

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.

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.

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>
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.

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.

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.

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.

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

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

Show code
<input aria-label="Example text box" type="text" placeholder="some cool text"/>

Other types of text are also supported






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 Guidelines, p. 176

A basic dialog is just a box with text in it. We use the .standard-dialog class here.

The Macintosh Finder, Version 1.0 (18 Jan 84)

© 1984 Apple Computer

Show code
<div class="standard-dialog center scale-down" style="width:30rem;">
  <h1 class="dialog-text">The Macintosh Finder, Version 1.0 (18 Jan 84)</h1>
  <p class="dialog-text">&copy; 1984 Apple Computer</p>
</div>

A modeless dialog box looks like a window without a size box, zoom box, or scroll bars.

Modeless Dialog

Show code
<div class="window scale-down" style="width:30rem;">
  <div class="title-bar">
    <button aria-label="Close" class="close"></button>
    <h1 class="title">Modeless Dialog</h1>
    <button aria-label="Resize" disabled class="hidden"></button>
  </div>
  <div class="separator"></div>

  <div class="modeless-dialog">
    <section class="field-row" style="justify-content: flex-start">
      <label for="text_find" class="modeless-text">Find:</label>
      <input id="text_find" type="text" style="width:100%;" placeholder=""/>
    </section>
    <section class="field-row" style="justify-content: flex-end">
      <button class="btn">Cancel</button>
      <button class="btn" style="width:95px;">Find</button>
    </section>
  </div>
</div>

We can also have a modal dialog box, which typically has some interactive component within it. It has a double-outline border. We achieve this by using a nested div. The outer div uses the .outer-border class and the .inner-border for the inner div.

Show code
<div class="modal-dialog outer-border" style="width: 30rem;">
  <div class="inner-border center">
    <div class="modal-contents">
      <h1 class="modal-text">Modal Dialog</h1>
      <div style="padding-left: 20px;">
        <div class="field-row">
          <input id="radio4" type="radio" name="second-example">
          <label for="radio4">Room</label>
        </div>
        <div class="field-row">
          <input id="radio5" type="radio" name="second-example">
          <label for="radio5">For</label>
        </div>
        <div class="field-row">
          <input id="radio6" type="radio" name="second-example">
          <label for="radio6">Stuff</label>
        </div>

      </div>
      <section class="field-row" style="justify-content: flex-end">
        <button class="btn">Cancel</button>
        <button class="btn" style="width:95px;">OK</button>
      </section>

    </div>

  </div>
</div>
Alert boxes appear when the system software or an application needs to communicate information to the user. Alert boxes provide messages about error conditions and warn users about potentially hazardous situations or actions
— Apple HI Guidelines, p. 176

Like modal dialogs, alert boxes also have a double-outline frame. The empty square is where you'd place an icon.

This is a standard alert box. The text would be placed here. This is where more text appears

Show code
<div class="alert-box outer-border scale-down"  style="width:30rem;">
  <div class="inner-border">
    <div class="alert-contents" style="padding-left: 30px; padding-right:20px;">
      <section class="field-row" style="justify-content: flex-start">
        <div class="square"></div>
        <p class="alert-text" style="padding-left:10px;">This is a standard alert box. The text would be placed here.
          This is where more text appears</p>
      </section>
      <section class="field-row" style="justify-content: flex-end">
        <button class="btn">Cancel</button>
        <button class="btn" style="width:95px;">OK</button>
      </section>

    </div>

  </div>
</div>

Contributing, Credits, etc.

Thanks for checking this project out! This library was made in good fun and was largely inspired by 98.css. The Chicago 12pt and Geneva 9pt fonts are recreations by @blogmywiki

System.css is still in beta! There's a few things that are currently missing that I incline on adding pretty soon. I recreated components based on Apple's Human Interface Guidelines. However, there's still a pretty good chance that I've might've missed/overlooked something essential. I've also had to recreate most of the assets, which can also be found here.

If you find a bug, consider opening an issue here. If there's something that you'd like to add, please feel free to create a PR!

If you'd like to see what else I'm up to, consider following me on Twitter or checking out my personal site :)

Sponsors

CSS Scan: The fastest and easiest way to check, copy and edit CSS