Skip to content

Commit 23162f9

Browse files
gadenbuiecpsievert
andauthored
chore: Apply suggestions from review
Co-authored-by: Carson Sievert <cpsievert1@gmail.com>
1 parent 7ce2c59 commit 23162f9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

scripts/README-porting-from-bslib.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Study the bslib implementation to understand:
5555
5. **Dependencies**: What other components or utilities it relies on
5656

5757
**Key patterns to note:**
58-
- How does the component register its input binding?
58+
- Is the component an input binding? If so, how does the binding register (typically via a CSS class)?
5959
- What markup structure does it generate on the server side?
6060
- How does the component integrate with Bootstrap classes?
6161
- How are configuration options passed from R to JavaScript -- data attributes, embedded JSON, etc.?
@@ -87,7 +87,7 @@ Create a new file in `shiny/ui/` for the component implementation.
8787

8888
**Common translations:**
8989
- R `tags$div()` → Python `div()` or `tags.div()`
90-
- R `!!!args` (splicing) → Python `**kwargs`
90+
- R `!!!args` (splicing) → Python `*args`+`**kwargs`
9191
- R `NULL` → Python `None`
9292
- R lists → Python dicts or lists as appropriate
9393
- R `paste0()` → Python f-strings or `.format()`
@@ -517,14 +517,14 @@ The component should work with all Bootstrap themes. The `make upgrade-html-deps
517517
Python style guide preferences:
518518
- Use `snake_case` for parameter names
519519
- Match bslib's parameter names when possible
520-
- Use `Optional[T]` for parameters that can be `None`
520+
- Use `Optional[T]` for user-facing parameters that can be `None`
521521
- Use `Literal` rather than `Enum` for parameters with specific allowed values
522522

523523
### Working with htmltools
524524

525525
Key patterns:
526-
- `Tag` objects are immutable by default, use `copy.copy()` if you need to modify
527-
- Use `tagAppendAttributes()` to add classes/attributes
526+
- `Tag` objects are mutable by default, use `copy.copy()` if you need to modify
527+
- Use `.add_class()`, `.add_style()`, `.attrs` to add CSS classes, styles, and HTML attributes
528528
- Use `css()` helper for inline styles
529529
- Tag children can be strings, Tags, TagLists, or None
530530

0 commit comments

Comments
 (0)