My Design System

Why I Created a Design System

I was using Material UI for a project, and the bundle size, combined with the css-in-js approach to styling, resulted in an application that was difficult to render on the server and that had a pretty poor initial load time. I wanted to create a design system that was similar to Material UI / Flutter but that emphasized semantic HTML and a small bundle size.

Also, when creating a Rich Text Editor with Lexical, I found that it was best to not use highly abstracted components, so I tried to create a library of simple components that can be easily rendered on the server and that doesn't use too much CSS and JavaScript.

In summary, the goal of the design system is to create a look that is comparable to other popular design libraries used today while minimizing load time, bundle size, and complexity.

Assumptions

The design system assumes that:

  • you want to use HTMX to create a SPA (Single Page Application),
  • you want to use semantic html, but that you want to style components primarily with CSS classes and inline styling,
  • your Content Security Policy allows for inline styling,
  • you want to use Floating UI for tooltips, menus, dropdowns, and the like,
  • you want to have slightly different layouts for desktop and mobile,
  • you want to prioritize mobile devices (you want the application that you show the user to always be similar to the mobile device view),
  • you do not want to listen to resize events on mobile

Explore the Design System

If you are looking for information about specific components or utility classes, use the links in the list below to find more information about those aspects of the system. Each aspect of the design system should describe the styling, accessability, and JavaScript concerns that go along with it.

If you are looking to learn more about the design system and the decisions made, continue reading below or navigate to the 'General' page for the design system.

If you want the code, navigate to the resources section.

Utility Classes

About Utility Classes

Utility Classes

Flex

.flex-row{display: flex!important;flex-direction: row!important;}
.flex-col{display: flex!important;flex-direction: column!important;}
.align-center{align-items: center!important;}
.align-start {align-items: flex-start!important;}
.align-end {align-items: flex-end!important;}
.justify-center{justify-content: center!important;}
.justify-start{justify-content: flex-start!important;}
.justify-end {justify-content: flex-end!important;}
.justify-between{justify-content: space-between!important;}
.grow-1 {flex-grow: 1!important;}
.grow-0 {flex-grow: 0!important;}
.wrap {flex-wrap: wrap!important;}
.gap-1 {gap: 4px 4px!important;}
.gap-2 {gap: 6px 6px!important;}
.gap-3 {gap: 8px 8px!important;}

Other:

.block {display: block!important;}
.inline {display: inline!important;}
.w-100{width: 100%;}
.w-auto{width:auto;}
.w-fc {width: fit-content;}
.w-sm {width: 150px!important;}
.w-md {width: 250px!important;}
.w-lg {width: 400px!important;}
.text-align-left {text-align: left!important;}
.text-align-center{text-align: center!important;}
.text-align-right{text-align: right!important;}
.overflow-hidden{overflow-x: hidden!important;overflow-y: hidden!important;}
.opaque {opacity: 1!important;}
.opaque:hover {opacity: 1!important;}
.opaque:focus {opacity: 1!important;}

Border:

.bb {border-bottom: 1px solid var(--divider)!important;}
.bb-main { border-bottom: 1px solid var(--text-primary)!important;}
.b-all { border: 1px solid var(--divider)!important;}
.b-all-main {border: 1px solid var(--text-primary)!important;}
.brad-0 {border-radius: 0px!important;}
.brad-sm {border-radius: 3px !important;}
.brad-md, .brad {border-radius: 6px!important;}
.brad-lg {border-radius: 12px!important;}
.circular {border-radius: 50%!important;}
.b-none{border: 0px none transparent !important;}
.br-0 {border-right: 0px transparent none !important;}
.bl-0 {border-left: 0px transparent none !important;}
.bt-0 {border-top: 0px transparent none !important;}
.bb-0 {border-bottom: 0px transparent none !important;}
.b-2 {border-width: 2px!important;}
.b-3 {border-width: 3px!important;}
.bl-1 {border-left: 1px solid var(--divider)!important;}
.bl-2 {border-left: 2px solid var(--divider)!important;}
.bl-3 {border-left: 3px solid var(--divider)!important;}
.b-main {border-color: var(--text-primary)!important;}
.b-divider {border-color: var(--divider)!important;}
.b-secondary {border-color: var(--text-secondary)!important;}
.br-1 {border-right: 1px solid var(--divider);}
.bt-1 {border-top: 1px solid var(--divider)!important;}

Margin and Padding:

/* ------- Margin Utilities ----------- */
.m-0 {margin: 0px!important;}
.mt-1 {margin-top: 4px!important;}
.mt-2 {margin-top: 8px!important;}
.mt-3 {margin-top: 12px!important;}
.mt-4 {margin-top: 16px;}
.mt-5 {margin-top: 20px;}
.ml-1 {margin-left: 4px!important;}
.mr-1 {margin-right: 4px!important;}
.mr-2 {margin-right: 8px!important;}
.ml-2 {margin-left: 8px!important;}
.mr-3 {margin-right: 12px!important;}
.ml-4 {margin-left: 12px!important;}
.mr-4 {margin-right: 16px!important;}
.ml-4 {margin-left: 16px!important;}

/* --------- Padding Utilities --------- */
.pt-sm {padding-top:4px!important;}
.pt-md {padding-top:6px!important;}
.pt-lg{padding-top:8px!important;}
.pb-sm {padding-bottom:4px!important;}
.pb-md {padding-bottom:6px!important;}
.pb-lg{padding-bottom:8px!important;}
.p-md {padding: 6px!important;}
.p-sm {padding: 4px!important;}
.p-lg {padding: 10px!important;}
.p-0 {padding: 0px!important;}
.pb-1 {padding-bottom: 4px!important;}
.pl-1 {padding-left: 4px !important;}
.pr-1 {padding-right: 4px !important;}
.pl-2 {padding-left: 8px!important;}
.pr-2 {padding-right: 8px!important;}
.indent-1 {padding-left: 15px!important;}
.indent-2 {padding-left: 30px!important;}
.indent-3 {padding-left: 45px !important;}
.indent-4 {padding-left: 60px !important;}

Keyboard Inputs

Here is an example of a keyboard Input CTRL+K. To make sure that the keyboard input will be an inline element, make sure that you add the .inline class to the <kbd> element.

The keyboard input will inherit the text size of its wrapper ENTER. You will probably need to edit the line-height of the <kbd> wrapper so the element does not cover up any text.

Horizontal Rule

Regular HR (hr):


Divider HR (hr.divider):


Primary HR (hr.divider):


Secondary HR (hr.divider):


Error HR (hr.divider):


Warning HR (hr.warning):


Info HR (hr.info):


Success HR (hr.success):


Bold HR (hr.bold):


Resources

Click on the individual buttons to download separate files, or click on the All Files button to download a ZIP file of all the code. The code is sent pre-transpiled for readability.
Click on the VSCode Snippet button to download a copy of the html.json file that will make implementing this design system simpler.