classafSlim::SlimTag
sys::Obj afSlim::SlimTag
A utility class for use by custom Slim components. Builds and writes a HTML tag with custom attrs.
- addAttr
- This addAttr(Str name, Str? value := null)- Adds a attr name value pair. - valuemay be- nullfor boolean attributes.
- addClass
- Adds a CSS class (if it's not - nullor empty).
- addStyle
- This addStyle(Str name, Str? value, Str size := "")- Adds a single CSS property to the - styleattribute.- sizeis appended to the value (if given).- nullvalues are skipped.- valueis wrapped in- var(...)if a CSS var name (starts with- --).- addStyle("padding", "2rem") addStyle("margin", "padding", "sm") addStyle("margin", "--padding-sm")
- attrBool
- Returns - trueif the attr name exists.
- attrEnum
- Returns the first enum value in the given SSV string, or - nullif not found.
- attrInt
- Returns the attr value as an Int. 
- attrSize
- Returns the attr value as a standard size, an empty string if the base value, or - nullif not found.
- attrStr
- Returns the attr value. 
- attrs
- classes
- Str[] classes
- fromCtx
- new fromCtx(SlimComponentCtx ctx, Str? tagName := null)- Creates a tag builder initialised from the given - SlimComponentCtx.- Tag Name defaults to ctx, falls back to the given name, or defaults to - div.
- id
- Str? id
- isSize
- Is the value one of the standard sizes? 
- make
- new make(Str? tagName := null)- Creates a tag builder. - Tag Name defaults to - div.
- sizes
- const static Str[] sizes := "xs sm lg xl".split- The standard sizes. 
- style
- Str style
- tagName
- Str tagName
- write
- Writes the opening start tag to the given out. 
- writeEnd
- Writes the end tag.