A wider screen, please

This page features interactive demos and side-by-side code samples that need at least 340 pixels of horizontal space. Please widen your browser window, or rotate your device, to continue.

Morpheus v0.1.0
v0.1.0

Condition#

Component <neo-condition> is a conditional wrapper: it shows its content only when a condition is true, and hides it otherwise. Right now that condition is the operating system. Use it only for what CSS can't check. CSS @media already handles touch, dark mode, and the like.

Reference#

Attributes #

NameTypeDefaultDescription
platformstring observednoneWhich platforms to show on. One or more of apple, windows, linux, separated by spaces to match any (windows linux). Prefix not to invert (not apple). Leave empty to show everywhere.

Slots #

NameDescription
defaultShown only while platform matches the current platform.

Condition syntax#

platform names the operating systems to show on:

  • apple: macOS or iOS (aliases mac, macos, ios).
  • windows (alias win).
  • linux (also Android / ChromeOS).

platform="windows linux" matches either; platform="not apple" matches everything but Apple.

Examples#

Platform branch#

Each branch carries platform-specific wording and shows only on its OS: you're seeing the one for your system.

On macOS, press to run the demo action.On Windows, press to run the demo action.On Linux, press to run the demo action.

This static demo shows only your own OS's branch, and swaps it in after the script loads, a brief flash. A templ server avoids that: pass the request user agent to ConditionOpts.UserAgent and the matching branch renders up front, no flash. To preview another OS here, open DevTools → Network conditionsUser agent client hintsPlatform, then reload.

Multiple platforms#

List several tokens to match any of them. Here one branch covers Windows and Linux together; the other is Apple-only.

Ctrl-based shortcuts (Windows and Linux).Command-based shortcuts (macOS and iOS).

Settings

Theme

Default Sunshine Ocean Matrix Rose

Accessibility

Playgrounds

Server Simulator