lenards/elm-ui-patternfly/4.0.1

NOTE: the latest version is 4.0.2

elm-ui-patternfly

An elm-ui implementation of the PatternFly 6 design system.

74 components · 7 layouts · Dark mode · Elm 0.19.1 · Builder pattern

Live Demo — Browse all components interactively (with dark mode toggle).


About

elm-ui-patternfly brings PatternFly 6's component library to Elm applications built with elm-ui. Every component follows the same builder pattern — construct a base value, pipe modifiers through it, and call toMarkup to get an Element msg. No HTML, no CSS, no class names.

elm install lenards/elm-ui-patternfly

Quick start

Every component follows the same pattern:

import PF6.Button as Button
import PF6.Badge as Badge

-- Construct → modify → render
Button.primary { label = "Save", onPress = Just Saved }
    |> Button.withLargeSize
    |> Button.withIcon myIcon
    |> Button.toMarkup

Badge.badge 7
    |> Badge.withOverflowAt 99
    |> Badge.toMarkup

All components produce Element msg values compatible with any elm-ui layout.


Design tokens

PF6.Tokens is the foundation of the component library — all colors, spacing, radii, and font sizes come from it. You can use tokens directly in your own layouts for visual consistency:

import PF6.Tokens as Tokens

Element.el
    [ Element.padding Tokens.spacerMd
    , Bg.color Tokens.colorBackgroundDefault
    , Font.color Tokens.colorText
    , Border.rounded Tokens.radiusMd
    ]
    content

Key token groups: color*, spacer*, fontSize*, radius*, fontWeight*.

Dark mode

PF6.Theme provides a theme system with light and dark palettes:

import PF6.Theme as Theme exposing (Mode(..), Theme)

theme = Theme.fromMode model.themeMode  -- Light or Dark

Element.el
    [ Bg.color (Theme.backgroundDefault theme)
    , Font.color (Theme.text theme)
    ]
    content

The pf6-guide live demo includes a dark mode toggle in the masthead.


Components

Primitives

ComponentModuleDescription
ButtonPF6.Button7 variants (primary, secondary, tertiary, danger, warning, link, plain), 3 sizes, icon support
BadgePF6.BadgeNumeric count badge with overflow cap and unread variant
LabelPF6.Label8 color variants, outline, compact, closable, icon support
AvatarPF6.AvatarUser avatar image, 3 sizes, optional border
IconPF6.IconSemantic icon wrapper with status colors and 4 sizes
TitlePF6.TitleHeading levels H1–H6 with PF6 sizing
DividerPF6.DividerHorizontal rule with inset variants

Feedback & Status

ComponentModuleDescription
AlertPF6.AlertInline alerts — default, success, danger, warning, info; optional close
BannerPF6.BannerFull-width site banners with optional link
SpinnerPF6.SpinnerAnimated loading indicator, 4 sizes
SkeletonPF6.SkeletonLoading placeholder — text lines, circle, and square variants
EmptyStatePF6.EmptyStateEmpty state with icon, title, body, and actions
ProgressPF6.ProgressProgress bar with status colors and size variants
HelperTextPF6.HelperTextForm field helper text — default, error, warning, success, indeterminate

Forms

ComponentModuleDescription
TextInputPF6.TextInputText field with label, placeholder, validation states, disabled
CheckboxPF6.CheckboxCheckbox with label and optional description
RadioPF6.RadioRadio button with label and optional description
SwitchPF6.SwitchToggle switch with on/off labels
NumberInputPF6.NumberInputNumeric input with increment/decrement, min/max/step, unit suffix
SearchInputPF6.SearchInputSearch field with clear, submit, and typeahead hints
SelectPF6.SelectSingle-select dropdown with option groups
FormPF6.FormForm layout with labeled groups, required markers, and helper text
ComponentModuleDescription
BreadcrumbPF6.BreadcrumbBreadcrumb trail with linked and current-page items
TabsPF6.TabsTab navigation — default, box, vertical, and filled variants
PaginationPF6.PaginationPage navigation with item count and compact variant

Layout

ComponentModuleDescription
CardPF6.CardContent card with title, footer, flat, compact, and selectable variants
PagePF6.PagePage shell with masthead, sidebar, and main content area
DrawerPF6.DrawerSliding panel — right, left, or bottom; inline or overlay mode

Overlays

ComponentModuleDescription
ModalPF6.ModalFull-viewport modal dialog with title, body, footer, and size variants
TooltipPF6.TooltipHover tooltip — top, bottom, left, right positioning
PopoverPF6.PopoverClick-triggered overlay with title, body, footer, and close button
DropdownPF6.DropdownAction dropdown with dividers, headers, and position control
AccordionPF6.AccordionExpandable content sections with bordered and large-display variants
ExpandableSectionPF6.ExpandableSectionSingle toggle-show/hide content block

Content

ComponentModuleDescription
CodeBlockPF6.CodeBlockRead-only code display with expandable variant
ClipboardCopyPF6.ClipboardCopyCopy-to-clipboard with inline and block variants
ListPF6.ListBulleted, ordered, plain, and inline list variants
DescriptionListPF6.DescriptionListTerm/value pairs — vertical and horizontal layouts
ActionListPF6.ActionListSpaced group of action buttons

Data

ComponentModuleDescription
TablePF6.TableData table with sortable columns, striped rows, compact, and bordered variants
DataListPF6.DataListFlexible list with checkable rows and expandable content
ToolbarPF6.ToolbarFilter/sort toolbar with item groups, separator, and item count

Additional

ComponentModuleDescription
BackToTopPF6.BackToTopFloating scroll-to-top button
BackdropPF6.BackdropSemi-transparent overlay background
BrandPF6.BrandLogo/brand image with responsive sizing
HintPF6.HintContextual hint with lighter styling than Alert
InputGroupPF6.InputGroupGroups form controls with shared borders
JumpLinksPF6.JumpLinksIn-page anchor navigation with subsections
MastheadPF6.MastheadTop header bar with brand, content, and toolbar slots
MenuPF6.MenuGeneric menu with items, dividers, headers, and search
NavigationPF6.NavigationVertical/horizontal application navigation
NotificationBadgePF6.NotificationBadgeBell icon with unread count overlay
NotificationDrawerPF6.NotificationDrawerSlide-out notification panel with variant icons
PanelPF6.PanelSimple bordered container with header/body/footer
PopoverPF6.PopoverClick-triggered overlay with title, body, and footer
ProgressStepperPF6.ProgressStepperMulti-step progress indicator
SidebarPF6.SidebarLayout container with sidebar panel and content area
SimpleListPF6.SimpleListClickable list with selection state
SkipToContentPF6.SkipToContentAccessibility skip-nav link, hidden until focused
SliderPF6.SliderRange slider input with PF6 styling
TextAreaPF6.TextAreaMulti-line text input with validation and resize
TextInputGroupPF6.TextInputGroupInput with prefix/suffix elements
TilePF6.TileSelectable card-like option tiles
TimestampPF6.TimestampFormatted date/time display with optional icon
ToggleGroupPF6.ToggleGroupButton group with toggle selection
TruncatePF6.TruncateText truncation with tooltip
WizardPF6.WizardMulti-step form wizard with sidebar navigation

Layouts

LayoutModuleDescription
BullseyePF6.BullseyeCenters content vertically and horizontally
FlexPF6.FlexConfigurable flex layout with direction, alignment, gap
GalleryPF6.GalleryResponsive grid of uniform items with min/max widths
GridPF6.Grid12-column grid system with percentage-based spans
LevelPF6.LevelEven horizontal distribution of items
SplitPF6.SplitHorizontal layout with fill items and wrapping
StackPF6.StackVertical layout with fill items

Theming

ModuleDescription
PF6.ThemeLight and dark mode color token system
PF6.TokensStatic design tokens (light mode defaults)

Example app — pf6-guide

The examples/pf6-guide/ directory contains a full interactive TEA application that demonstrates all 74 components with live state. A live version is deployed automatically to lenards.github.io/elm-ui-patternfly on every push to main.

cd examples/pf6-guide
npm install           # install dev tools (first time only)
npm run build         # compile Elm → main.js
npm run serve         # serve on http://localhost:8001

Or if you just want to compile and open directly without a server:

cd examples/pf6-guide
elm make src/Main.elm --output=main.js
open index.html

Note: elm reactor will show a blank page because it doesn't pre-compile main.js. Use npm run serve or open index.html after running elm make.

The guide is organized into 9 sections matching the component groups above. Every component is shown with multiple variants and real interactive state (forms you can type in, modals you can open, accordions you can expand, etc.).

To run the Playwright tests:

cd examples/pf6-guide
npm test

The test suite compiles the app automatically before running.


Contributing

Issues and pull requests are welcome. If you find a bug, have a component request, or want to suggest an improvement, please open an issue.


Resources