Expand description
Simple RSX - A lightweight JSX-like library for Rust
This crate provides a simple way to write HTML-like components in Rust using JSX-style syntax. It’s perfect for building user interfaces or generating HTML content with a familiar, component-based approach.
§Quick Start
use simple_rsx::*;
// Create a simple component
let greeting = rsx!(
<div class="greeting">
<h1>Hello, World!</h1>
<p>Welcome to Simple RSX</p>
</div>
);
// Convert to HTML string
println!("{}", greeting); // Outputs the HTML§Features
- JSX-like syntax with the
rsx!macro - Component-based architecture
- Type-safe attributes and children
- Easy conversion to HTML strings
- Support for custom components
§Custom Components
use simple_rsx::*;
#[derive(Default)]
struct ButtonProps {
text: String,
children: Vec<Node>,
}
#[component]
fn Button(props: ButtonProps) -> Node {
rsx!(
<button class="btn">
{props.text}
{props.children}
</button>
)
}Macros§
- rsx
- A procedural macro that provides JSX-like syntax for creating HTML elements in Rust.
Structs§
- Element
- Represents an HTML element with its tag name, attributes, and children.
- HTMLA
Element Props - HTML
Audio Element Props - HTML
Body Element Props - HTML
BrElement Props - HTML
Button Element Props - HTML
Canvas Element Props - HTML
Circle Element Props - HTML
Defs Element Props - HTML
DivElement Props - HTML
Ellipse Element Props - HTML
Foreign Object Element Props - HTML
Form Element Props - HTMLG
Element Props - HTML
H1Element Props - HTML
H2Element Props - HTML
H3Element Props - HTML
H4Element Props - HTML
H5Element Props - HTML
H6Element Props - HTML
Head Element Props - HTML
HrElement Props - HTML
Html Element Props - HTML
Iframe Element Props - HTML
ImgElement Props - HTML
Input Element Props - HTML
Label Element Props - HTML
LiElement Props - HTML
Line Element Props - HTML
Linear Gradient Element Props - HTML
Link Element Props - HTML
Mask Element Props - HTML
Meta Element Props - HTML
OlElement Props - HTML
Option Element Props - HTMLP
Element Props - HTML
Path Element Props - HTML
Polygon Element Props - HTML
Polyline Element Props - HTML
Radial Gradient Element Props - HTML
Rect Element Props - HTML
Script Element Props - HTML
Select Element Props - HTML
Source Element Props - HTML
Span Element Props - HTML
Stop Element Props - HTML
Style Element Props - HTML
SvgElement Props - HTML
Table Element Props - HTML
Tbody Element Props - HTML
TdElement Props - HTML
Textarea Element Props - HTML
Tfoot Element Props - HTML
ThElement Props - HTML
Thead Element Props - HTML
Title Element Props - HTML
TrElement Props - HTML
UlElement Props - HTML
UseElement Props - HTML
Video Element Props - a
- HTML
<a>element - Creates a hyperlink to other web pages or resources - audio
- HTML
<audio>element - Embeds sound content in the document - body
- HTML
<body>element - Represents the content of an HTML document - br
- HTML
<br>element - Produces a line break in text - button
- HTML
<button>element - Clickable button control - canvas
- HTML
<canvas>element - Container for graphics rendered with JavaScript - circle
- HTML
<circle>element - Draws a circle in SVG - defs
- HTML
<defs>element - Container for reusable SVG elements - div
- HTML
<div>element - Container element for grouping and styling content - ellipse
- HTML
<ellipse>element - Draws an ellipse in SVG - foreign
Object - HTML
element - Includes non-SVG elements inside SVG - form
- HTML
<form>element - Container for interactive inputs to collect user data - g
- HTML
<g>element - Groups SVG elements together - h1
- HTML
element - First level heading (most important)
- h2
- HTML
element - Second level heading
- h3
- HTML
element - Third level heading
- h4
- HTML
element - Fourth level heading
- h5
- HTML
element - Fifth level heading
- h6
- HTML
element - Sixth level heading (least important)
- head
- HTML
<head>element - Contains metadata about the document - hr
- HTML
<hr>element - Creates a horizontal rule (divider) - html
- HTML
<html>element - Root element of an HTML document - iframe
- HTML
<iframe>element - Embeds another document within the current HTML document - img
- HTML
<img>element - Embeds an image into the document - input
- HTML
<input>element - Creates interactive controls for forms - label
- HTML
<label>element - Caption for a form control - li
- HTML
<li>element - List item within ordered or unordered lists - line
- HTML
<line>element - Draws a line in SVG - linear
Gradient - HTML
element - Defines a linear gradient for SVG fills - link
- HTML
<link>element - Specifies relationships between the current document and an external resource - mask
- HTML
<mask>element - Defines an area where SVG elements are partially or fully hidden - meta
- HTML
<metaelement - Provides metadata about the document - ol
- HTML
<ol>element - Ordered (numbered) list - option
- HTML
<option>element - Defines option in a select dropdown - p
- HTML
<p>element - Represents a paragraph of text - path
- HTML
<path>element - Defines a path in SVG graphics - polygon
- HTML
<polygon>element - Draws a closed shape with straight lines in SVG - polyline
- HTML
<polyline>element - Draws connected straight lines in SVG - radial
Gradient - HTML
element - Defines a radial gradient for SVG fills - rect
- HTML
<rect>element - Draws a rectangle in SVG - script
- HTML
<script>element - Embeds executable code or data - select
- HTML
<select>element - Dropdown selection list - source
- HTML
<source>element - Defines media resources for video/audio elements - span
- HTML
<span>element - Inline container for targeting text with styles - stop
- HTML
<stop>element - Defines color transitions in gradients - style
- HTML
<style>element - Defines style information for a document - svg
- HTML
<svg>element - Container for SVG graphics - table
- HTML
<table>element - Creates a data table with rows and columns - tbody
- HTML
<tbody>element - Groups body content in a table - td
- HTML
<td>element - Table data cell - textarea
- HTML
<textarea>element - Multi-line text input control - tfoot
- HTML
<tfoot>element - Groups footer content in a table - th
- HTML
<th>element - Table header cell - thead
- HTML
<thead>element - Groups header content in a table - title
- HTML
<title>element - Defines the title of the document - tr
- HTML
<tr>element - Table row container - ul
- HTML
<ul>element - Unordered list with bullet points - use
- HTML
<use>element - Reuses an SVG element defined elsewhere - video
- HTML
<video>element - Embeds video content in the document
Enums§
- Node
- Represents a node in the RSX tree.
Traits§
- Attribute
- A trait for converting values into HTML attribute strings.
- Component
- A trait for creating reusable components.
- Option
Attribute - A trait for handling optional attribute values.
Attribute Macros§
- component
- A procedural macro that transforms a rust function into a component.