quarto-dev / quarto-dev/quarto-cli

Add more control on card components such as background colour

Open
#8,515 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dashboards enhancement themes
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Discussed in https://github.com/quarto-dev/quarto-cli/discussions/8504

Originally posted by meteosimon January 30, 2024

Description

Hi, I'm using quarto dashboard with python and I'm looking for an easy (and flexible) way to control the background color of cards. I know valueboxes and I like the way I can control their color and value using a dict. Can I control cards in a similar way?

Here's what I want my card to look like (the red one):
image

Generated with this input, the third column show's the way I thought would be nice to control the card? Is this somehow possible of in a similar way?

---
title: "MyDashboard"
format: dashboard
jupyter: python3
---

## Row

### Column

::: {.card title="MyTitle" expandable="false"}
Gapminder combines data from multiple sources into
unique coherent time-series that can’t be found elsewhere.
:::

### Column

<div class="card bslib-card html-fill-container bg-danger" data-title="MyTitle" data-require-bs-caller="card()">
<div class="card-header"><div class="card-title">MyTitle</div></div>
<div class="card-body html-fill-item html-fill-container bg-danger">
<p>Gapminder combines data from multiple sources into unique coherent time-series that can’t be found elsewhere.</p>
</div>
</div>

### Column

```{python}
#| content: card
#| output: false
dict(
  title = "MyTitle",
  color = "danger",
  value = """
  Gapminder combines data from multiple sources into unique coherent time-series that can’t be found elsewhere.
  """
)
```

````</div>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked discussion and reproduce the Python dashboard from the supplied QMD example. Trace how dashboard cards and valueboxes handle attributes and background styling; done means a flexible card background-color control works in the rendered dashboard and does not disrupt existing card behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.