hasty library

Classes

A single item inside a breadcrumb navigation trail.
Color
Colors
CssRule
A single CSS rule binding a selector (e.g. .btn:hover, body, a) to a typed Style and/or custom declarations.
FontWeight
MediaQuery
A responsive or preference @media query block containing CssRules.
Node
Parser
Shadows
Ready-made CSS box-shadow presets for elevation without raw CSS strings.
SitePage
Represents a single route/page in a multi-page static site built with emitSite.
Style
StyleSheet
A composable stylesheet that renders :root variables, optional resets, CssRules, and MediaQuery blocks into formatted or minified CSS.

Enums

AlertVariant
AlignSelf
Axis
BadgeVariant
BorderStyle
BoxSizing
ButtonVariant
CrossAxisAlignment
Maps Flutter-like cross-axis alignment names to CSS align-items values.
Cursor
Display
FlexDirection
FlexWrap
Float
FontStyle
MainAxisAlignment
Maps Flutter-like main-axis alignment names to CSS justify-content values.
ObjectFit
Position
Scope
TextAlign
TextDecoration
TextKind
TextTransform
WhiteSpace

Constants

hastyVersion → const String
Current version of the Hasty package and CLI.

Functions

a({required String href, String? content, List<Node>? children, String? id, String? classes, String? target, String? rel, String? download, Style? style, Map<String, String> data = const {}, Map<String, String> aria = const {}}) → Node
An anchor link (<a>). Supply content for plain text or children for rich nodes.
abbr(Object content, {required String title, String? id, Style? style, String? classes}) → Node
Abbreviation (<abbr>) with an expansion title.
accordion({required List<Node> items, double gap = 8, String? id, String? classes, Style? style}) → Node
Vertical stack of accordionItems with consistent spacing.
accordionItem({required String title, required List<Node> children, bool open = false, String? id, String? classes, Style? style}) → Node
A collapsible item built on native HTML <details> and <summary> (zero JS required).
alert(String message, {String? title, AlertVariant variant = AlertVariant.info, String? icon, String? id, String? classes, Style? style}) → Node
Contextual callout banner for informational, success, warning, or error messages.
article({String? id, String? classes, List<Node>? children, Style? style, String? role, Map<String, String> data = const {}, Map<String, String> aria = const {}}) → Node
A self-contained article container (<article>).
aside({String? id, String? classes, List<Node>? children, Style? style, String? role, Map<String, String> data = const {}, Map<String, String> aria = const {}}) → Node
Complementary sidebar / callout content (<aside>).
audio({String? src, bool controls = true, bool autoplay = false, bool loop = false, bool muted = false, List<Node>? children, String? id, String? classes, Style? style}) → Node
An audio player (<audio>).
avatar({String? imageUrl, String? initials, String? alt, double size = 40, Color backgroundColor = Colors.indigo, Color textColor = Colors.white, String? id, String? classes, Style? style}) → Node
Circular user/brand avatar showing either an imageUrl or fallback initials.
badge(String label, {required Color color, BadgeVariant variant = BadgeVariant.solid, String? id, String? classes, Style? style}) → Node
An inline status chip displaying label styled with color and variant.
blockquote(Object content, {String? cite, String? id, Style? style, String? classes}) → Node
Block quotation (<blockquote>).
br() → Node
A line break (<br>).
Accessible breadcrumb trail (<nav aria-label="Breadcrumb">). The final item (or any item without an href) is rendered as current text.
button(Object label, {String? id, String? type, String? classes, Style? style, ButtonVariant? variant, bool disabled = false, Map<String, String> data = const {}, Map<String, String> aria = const {}}) → Node
A button (<button>). Use variant for opinionated visual styles. Pass arbitrary data-* attributes via data and aria-* via aria.
caption(String content, {String? classes, Style? style}) → Node
A table caption (rendered above the table).
card({List<Node>? children, Style? style, double padding = 16, Color? backgroundColor, String? id, String? classes}) → Node
A layout container that wraps children in a styled box. Use padding and backgroundColor for quick visual customisation; any further overrides can be passed via style.
center({required Node child, Style? style, String? id, String? classes}) → Node
Centers a child both horizontally and vertically using flexbox.
code(Object content, {String? id, Style? style, String? classes}) → Node
Inline code snippet (<code>).
codeBlock(String source, {String? language, String? filename, String? id, String? classes, Style? style}) → Node
Pre-styled syntax/terminal code card with optional filename or language header.
col({int? span, String? classes, Style? style}) → Node
A single column definition inside a colgroup (void element).
colgroup({String? classes, Style? style, List<Node>? children}) → Node
A group of columns — lets you apply styles to whole columns at once.
comment(String text) → Node
An HTML comment (<!-- ... -->).
container({List<Node>? children, Node? child, double maxWidth = 960, double? padding, Style? style, String? id, String? classes}) → Node
Horizontally centered page/section container with a configurable maxWidth.
dd(Object content, {String? id, String? classes, Style? style}) → Node
A description definition (<dd>) inside a dl.
del(Object content, {String? id, Style? style, String? classes}) → Node
Deleted / strikethrough text (<del>).
details({String? summaryText, List<Node>? children, bool open = false, String? id, String? classes, Style? style, Map<String, String> data = const {}}) → Node
Native collapsible disclosure widget (<details>).
dialog({List<Node>? children, bool open = false, String? id, String? classes, Style? style, Map<String, String> data = const {}, Map<String, String> aria = const {}}) → Node
Native modal or non-modal dialog box (<dialog>).
div({String? id, String? classes, List<Node>? children, Style? style, String? role, Map<String, String> data = const {}, Map<String, String> aria = const {}}) → Node
A generic container (<div>).
divider({Axis axis = Axis.horizontal, Color color = Colors.lightGray, double thickness = 1, double? spacing, Style? style, String? classes}) → Node
Visual horizontal or vertical separator (inspired by SwiftUI's Divider).
dl({String? id, String? classes, Style? style, List<Node>? children}) → Node
A description list (<dl>) for key-value / term-definition pairs.
dt(Object content, {String? id, String? classes, Style? style}) → Node
A description term (<dt>) inside a dl.
em(Object content, {String? id, Style? style, String? classes}) → Node
Italic / emphasized text (<em>).
emit(Node root, {String outputDir = 'build', String fileName = 'index', String title = '', String lang = 'en', String? description, String? favicon, Map<String, String> meta = const {}, List<String> stylesheets = const [], List<String> scripts = const [], StyleSheet? styleSheet, List<Node> head = const [], Style? bodyStyle, String? bodyClasses, bool minify = false, bool quiet = false}) → Future<void>
Emits a complete HTML page for root to [outputDir]/[fileName].html.
emitCss(StyleSheet styleSheet, {String outputDir = 'build', String fileName = 'styles', bool minify = false, bool quiet = false}) → Future<void>
Emits a StyleSheet to [outputDir]/[fileName].css.
emitSite(List<SitePage> pages, {String outputDir = 'build', String lang = 'en', String? favicon, List<String> stylesheets = const [], List<String> scripts = const [], StyleSheet? sharedStyleSheet, String sharedStyleSheetName = 'styles.css', List<Node> sharedHead = const [], Style? bodyStyle, String? bodyClasses, Node layout(Node body, SitePage page)?, bool prettyUrls = false, bool generateSitemap = false, String? baseUrl, bool minify = false, bool quiet = false}) → Future<void>
Generates a complete multi-page static site from pages into outputDir.
expanded({required Node child, int flex = 1, Style? style, String? id, String? classes}) → Node
Wraps a child so it expands proportionally inside an hStack or vStack.
fieldset({String? id, String? classes, Style? style, List<Node>? children, bool disabled = false}) → Node
A labelled group of form controls.
figcaption(Object content, {String? id, String? classes, Style? style}) → Node
Caption for a figure (<figcaption>).
figure({String? id, String? classes, List<Node>? children, Style? style}) → Node
Self-contained media or diagram wrapper (<figure>).
A page or section footer (<footer>).
form({String? action, String? method, String? enctype, String? id, String? classes, Style? style, List<Node>? children, Map<String, String> data = const {}}) → Node
A form container (<form>).
formatCliUsage() → String
Returns the formatted CLI help text for the hasty executable.
fragment(List<Node> children) → Node
Groups multiple children without emitting a wrapper HTML tag (like SwiftUI's Group or React's Fragment).
grid({int? columns, double? minChildWidth, double? gap, double? rowGap, double? columnGap, CrossAxisAlignment? alignItems, List<Node>? children, Style? style, String? id, String? classes}) → Node
CSS Grid container.
h1(Object content, {String? id, Style? style, String? classes, Map<String, String> data = const {}}) → Node
h2(Object content, {String? id, Style? style, String? classes, Map<String, String> data = const {}}) → Node
h3(Object content, {String? id, Style? style, String? classes, Map<String, String> data = const {}}) → Node
h4(Object content, {String? id, Style? style, String? classes, Map<String, String> data = const {}}) → Node
h5(Object content, {String? id, Style? style, String? classes, Map<String, String> data = const {}}) → Node
h6(Object content, {String? id, Style? style, String? classes, Map<String, String> data = const {}}) → Node
A page or section header (<header>).
heroSection({required String title, String? subtitle, String? eyebrow, Color accentColor = Colors.indigo, List<Node>? actions, CrossAxisAlignment alignment = CrossAxisAlignment.center, String? id, String? classes, Style? style}) → Node
Prominent page hero banner with optional eyebrow badge, title, subtitle, and call-to-action actions.
hr({Style? style, String? classes}) → Node
A horizontal rule (<hr>).
hStack({List<Node>? children, Style? style, MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start, CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center, String? id, String? classes}) → Node
Horizontal stack of children — maps to a row flexbox div.
iframe({required String src, String? title, int? width, int? height, String? loading, String? allow, bool allowfullscreen = false, String? id, String? classes, Style? style}) → Node
An embedded frame (<iframe>).
img({required String src, String? alt, int? width, int? height, String? loading, String? id, String? classes, Style? style, Map<String, String> data = const {}}) → Node
An image (<img>).
input({String type = 'text', String? name, String? id, String? value, String? placeholder, String? min, String? max, String? step, String? pattern, String? accept, String? autocomplete, String? classes, Style? style, bool required = false, bool disabled = false, bool readonly = false, bool checked = false, Map<String, String> data = const {}, Map<String, String> aria = const {}}) → Node
A form input (void element — no children). Pass arbitrary data-* attributes via data.
ins(Object content, {String? id, Style? style, String? classes}) → Node
Inserted text (<ins>).
kbd(Object content, {String? id, Style? style, String? classes}) → Node
Keyboard input element (<kbd>).
label({String? htmlFor, String? content, String? classes, Style? style, List<Node>? children}) → Node
A form label. Use htmlFor to associate it with an input's id. Supply either content for plain text or children for richer markup.
legend(String content, {String? classes, Style? style}) → Node
A caption for a fieldset.
li(Object content, {int? value, String? id, Style? style, String? classes, Map<String, String> data = const {}}) → Node
A list item (<li>). Accepts a String, Node, or List<Node>.
linkTag({required String rel, required String href, String? type, String? media, String? sizes, bool crossorigin = false}) → Node
Document <link> tag (void element), e.g. stylesheets, icons, preconnect.
main_({String? id, String? classes, List<Node>? children, Style? style, String? role, Map<String, String> data = const {}, Map<String, String> aria = const {}}) → Node
The main content area (<main>).
mark(Object content, {String? id, Style? style, String? classes}) → Node
Highlighted / marked text (<mark>).
markdown(String source, {String tag = 'div', String? id, String? classes, Style? style, bool headingIds = true}) → Node
Converts a Markdown source document into a container Node (<div> or <article>).
meta({String? name, String? property, String? content, String? charset, String? httpEquiv}) → Node
Document <meta> tag (void element).
meter({required double value, double? min, double? max, double? low, double? high, double? optimum, String? id, String? classes, Style? style}) → Node
Scalar gauge (<meter>).
A navigation container (<nav>).
A horizontal navigation bar containing navLink (or other) items. Renders as a <nav> with a flex-row layout and a default gap between items.
A link item for use inside navBar.
ol({List<Node>? children, int? start, bool reversed = false, String? id, String? classes, Style? style, Map<String, String> data = const {}}) → Node
An ordered list (<ol>).
optgroup({required String label, List<Node>? children, bool disabled = false}) → Node
A grouped set of options inside a select.
option({required String value, required String content, bool selected = false, bool disabled = false}) → Node
An option inside a select.
p(Object content, {String? id, Style? style, String? classes, Map<String, String> data = const {}}) → Node
A paragraph (<p>). Accepts a String, Node, or List<Node> for rich inline text.
padding({required Node child, double? all, double? horizontal, double? vertical, double? top, double? right, double? bottom, double? left, String? id, String? classes}) → Node
Wraps a single child with padding.
parseInlineMarkdown(String input) → List<Node>
Parses inline Markdown formatting (**bold**, *italic*, _italic_, `code`, ~~del~~, [links](url), and ![images](src)) into Nodes.
parseMarkdownNodes(String source, {bool headingIds = true}) → List<Node>
Parses a Markdown source string into a list of top-level Hasty Nodes.
picture({List<Node>? children, String? id, String? classes, Style? style}) → Node
Responsive <picture> container wrapping source elements and a fallback img.
pre(Object content, {String? id, Style? style, String? classes}) → Node
Preformatted text block (<pre>).
progress({double? value, double? max, String? id, String? classes, Style? style}) → Node
Native <progress> indicator.
progressBar({required double value, double max = 100, Color color = Colors.indigo, Color trackColor = Colors.lightGray, double height = 8, String? label, bool showPercentage = false, String? id, String? classes, Style? style}) → Node
Visual horizontal progress bar with optional label and percentage readout.
raw(String html) → Node
Injects html as-is without any escaping. UNSAFE — only use this with content you fully control. Never pass user-supplied data to this function.
renderDocument(Node root, {String title = '', String lang = 'en', String? description, String? favicon, Map<String, String> meta = const {}, List<String> stylesheets = const [], List<String> scripts = const [], StyleSheet? styleSheet, List<Node> head = const [], Style? bodyStyle, String? bodyClasses, bool minify = false}) → String
Renders a complete <!DOCTYPE html> document string for root without disk I/O.
renderHtml(Node root, {bool minify = false}) → String
Returns the HTML fragment string for root without writing any files. Pass minify: true to strip indentation and newlines.
runHastyCli(List<String> args, {Logger? logger}) → Future<int>
Entrypoint logic for the hasty CLI binary. Returns a process exit code.
script({String? src, String? content, String? type, bool defer = false, bool async = false}) → Node
External or inline <script> tag. Inline content is emitted without HTML entity escaping (while preventing </script> breakout).
section({String? id, String? classes, List<Node>? children, Style? style, String? role, Map<String, String> data = const {}, Map<String, String> aria = const {}}) → Node
A semantic section (<section>).
select({String? name, String? id, String? classes, Style? style, List<Node>? children, bool required = false, bool disabled = false, bool multiple = false, Map<String, String> data = const {}}) → Node
A dropdown selector.
small(Object content, {String? id, Style? style, String? classes}) → Node
Fine print / side-comment text (<small>).
source({required String src, String? type, String? media, String? srcset}) → Node
Media <source> element inside video, audio, or picture (void element).
spacer({double? size, int flex = 1}) → Node
Flexible spacer that expands to fill available space in a flex container, or occupies a fixed size in pixels when size is provided.
span(Object content, {String? id, Style? style, String? classes, Map<String, String> data = const {}, Map<String, String> aria = const {}}) → Node
An inline <span>. Accepts a String, Node, or List<Node>.
statCard({required String icon, required String value, required String label, required Color color, String? id, String? classes, Style? style}) → Node
A compound card displaying an icon, a large value string, and a label caption on a coloured background. Uses card internally.
strong(Object content, {String? id, Style? style, String? classes}) → Node
Bold text (<strong>).
sub(Object content, {String? id, Style? style, String? classes}) → Node
Subscript text (<sub>).
summary(Object content, {String? id, String? classes, Style? style}) → Node
Summary heading inside a details element (<summary>).
sup(Object content, {String? id, Style? style, String? classes}) → Node
Superscript text (<sup>).
table({String? id, String? classes, Style? style, List<Node>? children}) → Node
A table.
tbody({String? classes, Style? style, List<Node>? children}) → Node
A table body group.
td({String? content, int? colspan, int? rowspan, String? classes, Style? style, List<Node>? children}) → Node
A table data cell.
text(Object content, {TextKind kind = TextKind.body, String? id, Style? style, String? classes, Map<String, String> data = const {}, Map<String, String> aria = const {}}) → Node
A text element. Use kind to pick the semantic tag (default: body → <p>). content may be a String, a single Node, or a List<Node>.
textarea({String? name, String? id, String? placeholder, int? rows, int? cols, String? content, String? classes, Style? style, bool required = false, bool disabled = false, bool readonly = false, Map<String, String> data = const {}, Map<String, String> aria = const {}}) → Node
A multi-line text input. Pass arbitrary data-* attributes via data.
tfoot({String? classes, Style? style, List<Node>? children}) → Node
A table footer group.
th({String? content, int? colspan, int? rowspan, Scope? scope, String? classes, Style? style, List<Node>? children}) → Node
A table header cell. Use scope to declare what it headers.
thead({String? classes, Style? style, List<Node>? children}) → Node
A table header group.
time(Object content, {String? datetime, String? id, Style? style, String? classes}) → Node
Machine-readable date/time (<time>).
tr({String? classes, Style? style, List<Node>? children}) → Node
A table row.
txt(String content) → Node
Plain unwrapped text node — ideal for mixing text and inline tags inside lists of Nodes.
ul({List<Node>? children, String? id, String? classes, Style? style, Map<String, String> data = const {}}) → Node
An unordered list (<ul>).
video({String? src, String? poster, int? width, int? height, bool controls = true, bool autoplay = false, bool loop = false, bool muted = false, bool playsinline = false, List<Node>? children, String? id, String? classes, Style? style}) → Node
A video player (<video>).
vStack({List<Node>? children, Style? style, MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start, CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.stretch, String? id, String? classes}) → Node
Vertical stack of children — maps to a column flexbox div.
wrap({List<Node>? children, double? gap, double? rowGap, double? columnGap, MainAxisAlignment alignment = MainAxisAlignment.start, CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center, Style? style, String? id, String? classes}) → Node
Wrapping horizontal flex layout (like Flutter's Wrap). Automatically wraps children onto additional lines when space runs out.
zStack({List<Node>? children, Style? style, String? id, String? classes}) → Node
Layered stack — children are positioned on top of each other. The container is position:relative; children should use position:absolute.

Exceptions / Errors

ArgParseException