AnswerDotAI / AnswerDotAI/fasthtml

[BUG] `set_pico_cls()` Fails to Add Classes in Jupyter Notebook Output

Open
#631 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Jupyter Notebook
Stars
7k
Forks
319
Avg merge
28m
Merged PRs (30d)
3

Description

### Describe the Problem
In Jupyter Notebook, when I use `set_pico_cls()` along with `show(picocondlink)` to apply Pico styling, the expected styling doesn’t show up in the output

### Steps to Reproduce
Here’s a simple example to show the issue:

```python
from fasthtml.common import *
```

```python
show(picocondlink)
set_pico_cls()
```

```python
show(Titled("Greeting", Div(P("Hello World!")), Button("Hello")))
```

### What I Expected
I was expecting `set_pico_cls()` to automatically apply the `pico` class to the elements, but it didn’t.

### Workaround I Found
As a temporary fix, I used this helper function to manually apply the `pico` class:

```python
def show_with_pico(*args):
return show(Div(*args, cls="pico"))
```

It’s not ideal, but it works for now.

### Environment Details
Here are the versions of the libraries I’m using:
- **fastlite**: 0.1.1
- **fastcore**: 1.7.28
- **fasthtml**: 0.11.0

### Confirmation Checklist
- [x] I’ve checked the [[FAQ](https://docs.fastht.ml/explains/faq.html)](https://docs.fastht.ml/explains/faq.html) to see if this is a known issue.
- [x] I’ve included a minimal example to reproduce the problem.
- [x] I’ve provided the library versions I’m using.
- [x] I understand this is a volunteer-driven open-source project.

### Screenshot of the Problem
![Output Screenshot](https://github.com/user-attachments/assets/753049c8-d3d4-4e56-a66f-9575d08e0085)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.