Skip to content

web.components #

fn icon_ellipsis #

fn icon_ellipsis() string

fn kanban_example #

fn kanban_example() KanbanViewData

fn markdown #

fn markdown(path string) !Markdown

fn to_struct #

fn to_struct[T](t T) Struct

interface IComponent #

interface IComponent {
	html() string
}

interface ILayout #

interface ILayout {
	html() string
mut:
	main IComponent
}

interface IView #

interface IView {
	html() string
}

enum HeadingLevel #

enum HeadingLevel {
	one = 1
	two
	three
	four
	five
}

enum ImageType #

enum ImageType {
	@none
	thumbnail
}

enum PriorityEnum #

enum PriorityEnum {
	critical
	urgent
	normal
	low
	no
}

struct Anchor #

struct Anchor {
pub:
	href    string
	content string
}

Define HTML element structs implementing the IComponent interface

struct Button #

struct Button {
	Unpoly
pub mut:
	onclick  string
	typ      string
	content  string
	navigate string // the route the button is to navigate to, if it is
}

fn (Button) html #

fn (button Button) html() string

struct Cell #

struct Cell {
pub:
	content string
}

fn (Cell) html #

fn (component Cell) html() string

struct Chat #

struct Chat {
pub:
	messages []Message
}

fn (Chat) html #

fn (chat Chat) html() string

struct Dashboard #

struct Dashboard {
pub:
	user string
}

fn (Dashboard) html #

fn (component Dashboard) html() string

struct Event #

struct Event {
pub:
	swimlane string
	subject  string
	deadline string
	link     string
	color    ColorEnum
	assigned string
	priority PriorityEnum
	labels   string // comma separated
}

struct Feed #

struct Feed {
pub:
	feed []Post
}

fn (Feed) html #

fn (feed Feed) html() string

struct Field #

struct Field {
pub:
	name  string
	ftype string // data type of the field (e.g., string, int, bool, map, array)
	value string // value of the field as a string
}

struct Form #

struct Form {
pub:
	id      string
	content IComponent
}

fn (Form) html #

fn (form Form) html() string

struct Group #

struct Group {
pub:
	components []IComponent
}

fn (Group) html #

fn (group Group) html() string

fn (Head) html #

fn (head Head) html() string

struct Heading #

struct Heading {
pub:
	content string
	level   HeadingLevel
}

fn (Heading) html #

fn (heading Heading) html() string

struct HeadingGroup #

struct HeadingGroup {
pub:
	components []IComponent
}

fn (HeadingGroup) html #

fn (component HeadingGroup) html() string

struct IFrame #

struct IFrame {
pub mut:
	source string
}

fn (IFrame) html #

fn (iframe IFrame) html() string

struct Image #

struct Image {
pub:
	typ    ImageType
	source string
}

fn (Image) html #

fn (image Image) html() string

struct IncrementalInput #

struct IncrementalInput {
pub:
	label string
	typ   string
}

fn (IncrementalInput) html #

fn (input IncrementalInput) html() string

struct Input #

struct Input {
pub:
	id          string
	name        string
	label       string
	placeholder string
	required    bool
	typ         string
	value       string
}

fn (Input) html #

fn (input Input) html() string

struct KanbanViewData #

struct KanbanViewData {
pub:
	swimlanes []Swimlane
	events    []Event
}

fn (KanbanViewData) html #

fn (data KanbanViewData) html() string

fn (Link) html #

fn (link Link) html() string

struct ListItem #

struct ListItem {
	children []IComponent
}

struct Markdown #

struct Markdown {
pub:
	doc elements.Doc
}

fn (Markdown) html #

fn (md Markdown) html() string

struct MarkdownContent #

struct MarkdownContent {
pub mut:
	nav     string
	content string
	title   string
}

struct Message #

struct Message {
pub:
	timestamp string
	sender    string
	content   string
}

struct Opt #

struct Opt {
pub:
	content string
	value   string
}

fn (Opt) html #

fn (option Opt) html() string

struct PDFViewer #

struct PDFViewer {
pub:
	name         string
	pdf_url      string
	log_endpoint string
}

fn (PDFViewer) html #

fn (component PDFViewer) html() string

struct Page #

struct Page {
pub mut:
	heading PageHeading
	content IComponent
	scripts []Script
}

fn (Page) html #

fn (page Page) html() string

struct PageHeading #

struct PageHeading {
pub:
	title       string
	subtitle    string
	buttons     []Button
	breadcrumbs ?Breadcrumbs
}

fn (PageHeading) html #

fn (heading PageHeading) html() string

struct Paragraph #

struct Paragraph {
pub:
	content string
}

struct Post #

struct Post {
pub:
	timestamp   string
	user        string
	typ         string @[json: 'type'] // Can be "text", "news", or "image"
	content     string
	description string // Only for image posts, optional
}

struct Row #

struct Row {
pub:
	cells []Cell
}

fn (Row) html #

fn (component Row) html() string

struct Script #

struct Script {
pub:
	source string
	async  string
}

fn (Script) html #

fn (script Script) html() string

fn (SearchBar) html #

fn (input SearchBar) html() string

struct Select #

struct Select {
pub:
	name    string
	options []Opt
}

fn (Select) html #

fn (input Select) html() string

fn (Sidebar) html #

fn (sidebar Sidebar) html() string

struct Struct #

struct Struct {
pub:
	typ    string
	fields []Field
}

struct Swimlane #

struct Swimlane {
pub:
	name  string
	color ColorEnum
}

struct Table #

struct Table {
pub:
	headers []string
	rows    []Row
}

fn (Table) html #

fn (table Table) html() string

struct UnorderedList #

struct UnorderedList {
	children []IComponent
}

struct Unpoly #

struct Unpoly {
pub:
	up_link string
}

fn (Unpoly) html #

fn (unpoly Unpoly) html() string

struct View #

struct View {
pub mut:
	head   Head
	layout ILayout
}

fn (View) html #

fn (view View) html() string