Skip to content

p-text

p-text allows you to set the text of an element, the value of this attribute can be any valid python expression.

It can be any type, not necessarily string.

Simple value

index.html
<h4 p-text="'hello'"></h4>

Using value from the store

You can use p-text to replace text with a value from the store, here is a little example :

demo.py
from prune import Prune
Prune(username="John")
index.html
<h4 p-text="store.username"></h4>

Playing with f string

You can use f string in p-text (and in all others p- attribute)

index.html
<h4 p-text="f'The Username is : {store.username}, its age is {10*2}'"></h4>