Skip to content

First example in online Prefab docs, under Template Expressions under Concepts->Expressions seems faulty #486

Description

@Sharadhonavar

What happened?

I am a newbie on Github collaboration and also Prefab. I read the Contributing doc but did not see any guidelines for issues on online docs.I could not find any other classification than a "bug" which it is not, but a doc issue. Pardon me if I am doing this all wrong.

Refering to the First example in online docs Template Expressions under Expressions under Concepts seems faulty . Clicking the + and - Buttons show "NaN" in the Badge. And the explanatory para below the code refers to the display as a Text("{{ count }}") component but the code specifies Badge("{{ count }}", variant="{{ count > 0 ? 'success' : 'destructive' }}"). And not Text, though it may compile to Text underneath.

And the variant prop is not explained here, maybe later down

Example Code

from prefab_ui.components import Button, Row, Badge
from prefab_ui.actions import SetState


with Row(gap=3, align="center"):
    Button("-", variant="outline", on_click=SetState("count", "{{ count - 1 }}"))
    Badge("{{ count }}", variant="{{ count > 0 ? 'success' : 'destructive' }}")
#doc says Text(...
    Button("+", variant="outline", on_click=SetState("count", "{{ count + 1 }}"))

Version Information

https://prefab.prefect.io/docs/concepts/expressions. The tag leading from the doc page to github repo shows Prefab v0.20.2. Firefox 152.0.6 and Chromium 150.0.7871.128  on Ubuntu 24.04.4 LTS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationUpdates to docs, examples, or guides. Primary change is documentation-related.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions