✍️Syntax

Quickly learn the simple phyal syntax to get started right away

phyal components go hand in hand with HTML elements but are written in the Python programming language. Here’s a quickstart guide to the phyal syntax.

  • You can use an element by setting up an advised html_content variable ->

html_content = str(
    Tags.#element
)
  • You can then add your element to the line, for example the paragraph element or <p> ->

Tags.p('Hello, world!')

The first set of parentheses on all elements is for text (if it is used withen HTML, think <a> tags, or <h1> tags, etc.)

  • Then you can add attributes, things like HREF's SRC's ALT's would fall in this category. You would add .attribute(# attribute()) to your line, for example an <a> tag ->

Tags.a('Link').attr('href', 'https://google.com')
  • You can add ID's like so .id('') (such as uses in JavaScript in CSS), for example with a <p> tag ->

Tags.p('Hello, world!').id('my_id')
  • You can also add children to the elements in a hireachy system like HTML like so .add_children(Tags.) # Element, for example a <p> tag ->

Tags.div().id('container').child(
    Tags.h1('Title').id('title'),
    # Add more children here if needed
)

Now that you have mastered the phyal syntax you should be able to use phyal to it‘s largest potential, if you come across any errors make sure to create an issue here.

Last updated