Web Development Reference

Kip Landergren

(Updated: )

My cheat sheet for web development covering CSS and helpful resources.

Contents#

CSS Libraries#

TailwindCSS#

Tailwind CSS Reference

CSS-in-JS#

CSS Modules#

The gist:

Of note:

emotion#

linaria#

Panda#

styled-components#

StyleX#

Type-safe style compiler for authoring strict styles in TypeScript / JavaScript.

vanilla-extract#

Component Libraries#

Base UI (mui/base-ui)#

Radix#

From README.md:

Radix Primitives is a low-level UI component library with a focus on accessibility, customization and developer experience. You can use these components either as the base layer of your design system, or adopt them incrementally.

I think of Radix as the supplier of unstyled React components to build upon. They have solved common functionality and behavior problems (e.g. “how exactly should a context menu work?”) and can be built upon.

Repository Overview#

philosophy.md explains vision and principles
packages/core internal helpers
packages/react components and hooks

Primitives#

A primitive component Foo has exports such that:

Foo.Root Root is an alias pointing back to Foo
Foo.Bar1 Bar1 is some descendant component
Foo.Bar2 Bar2 is some descendant component

I believe this is for the DX of always having .Root access the topmost radix-ui component of the module.

Slot#

Notes#

Resources#

shadcn/ui#

From the Introduction:

shadcn/ui is a set of beautifully-designed, accessible components and a code distribution platform. Works with your favorite frameworks and AI models. Open Source. Open Code.

This is not a component library. It is how you build your component library.

This latter description is because its goal is to provide components whose source is copied directly into your repository and modified according to your needs.

Notes#

The default style has been deprecated. Use the new-york style instead.

Repository Overview#

CONTRIBUTING.md includes a repository structure overview
app/www/components React components used in the shadcn-ui website
app/www/registry components to use in your applications
app/www/registry/default (deprecated) the “default” style implementations
app/www/registry/default/ui (deprecated) the “default” tsx component code
app/www/registry/new-york the “new york” style implementations
app/www/registry/new-york/ui the “new york” tsx component code
packages/cli (?? deprecated ??) the old CLI code
packages/shadcn the current CLI code

Resources#

Other Libraries#

Class Variance Authority (cva)#

Structured way of defining JavaScript objects such that className strings can be composed based on defined “variants”. Inspired many CSS-in-JS libraries’ functionality.

PostCSS#

a .css file being processed by PostCSS and turned into an abstract syntax tree before being recompiled into a new .css file with changes from plugins applied

Web APIs#

IndexedDB#

Client-side database implemented in JavaScript.

WindowOrWorkerGlobalScope#

Events#

Keys#

ArrowUp
ArrowDown
ArrowLeft
ArrowRight

Management#

onFocus()#

Important

There does not appear to be a robust way of determining whether a focus event was initiated by user mouse, user keyboard, or programatic action.

Create a favicon.ico from .png#

$ convert public/image.png     \
  \( -clone 0 -resize 16x16 \) \
  \( -clone 0 -resize 24x24 \) \
  \( -clone 0 -resize 32x32 \) \
  \( -clone 0 -resize 48x48 \) \
  \( -clone 0 -resize 64x64 \) \
  -delete 0                    \
  -alpha off                   \
  -colors 256                  \
  ./public/favicon.ico

Resources#

Others:

Terminology#

AD (Active Directory)#
1.
AuthN#
1.
asynchronous#
1.
atomic CSS#
1.

One utility class name maps to one CSS rule. e.g. TailwindCSS’ flex maps to display: flex;

Also: atomic styles

Related:

blocking#
1.
client-side#
1.

The DOM and JavaScript that runs in the user’s browser.

Related:

DMZ (demilitarized zone)#
1.

Referring to subnetwork between an organization’s internal network and untrusted external networks.

DOM (Document Object Model)#
1.

A platform-neutral model for events, aborting activities, and node trees.

Related:

event loop#
1.
FIDO#
1.
front end web server#
1.

Server that serves static assets (JavaScript, CSS, HTML) and may route dynamic requests (other web pages, API calls)

Also: UI server

Related:

headless component architecture#
1.

shadcn/ui uses; something something internals are able to be updated without affecting usage but I don’t see how

Related:

IdP (identity provider)#
1.
leaf component#
1.

The outermost / final descendant of a component tree.

Related:

non-blocking#
1.
nonce#
1.
OpenId#
1.
pepper#
1.
polyfill#
1.

A piece of code—typically JavaScript—used to provide modern functionality to browsers that do not natively support it.

Related:

SAML#
1.
salt#
1.
thick client#
1.
utility class#
1.
variant#
1.
vendor prefix#
1.

The browser (vendor) prefix added to CSS rules and JavaScript APIs that enable browser-specific behavior. Note: According to MDN this is being phased out.

Related: