Skip to content

Conversation

@gadenbuie
Copy link
Collaborator

For humans and LLMs!

I used the recent input_submit_textarea() PRs to seed these guidelines:

@gadenbuie gadenbuie requested a review from cpsievert October 28, 2025 16:02

Key patterns:
- `Tag` objects are immutable by default, use `copy.copy()` if you need to modify
- Use `tagAppendAttributes()` to add classes/attributes
Copy link
Collaborator

@cpsievert cpsievert Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably also add the __init__() based approach?

Suggested change
- Use `tagAppendAttributes()` to add classes/attributes
- Use `.add_class()`, `.add_style()`, `.attrs` to add CSS classes, styles, and HTML attributes

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you say more about what you mean by the __init__() based approach? (I'm on board with the suggested change, but that seems unrelated unless I'm missing a step.)

Copy link
Collaborator

@cpsievert cpsievert Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean something like it should prefer div(class_ = "foo") to x = div() then x.add_class("foo")

Copy link
Collaborator

@cpsievert cpsievert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea, thanks!

Co-authored-by: Carson Sievert <cpsievert1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants