Skip to content

Upgrade Tailwind and Daisy to support v4#1723

Open
Simrayz wants to merge 14 commits intomainfrom
chore/1262-tailwind-v4-upgrade
Open

Upgrade Tailwind and Daisy to support v4#1723
Simrayz wants to merge 14 commits intomainfrom
chore/1262-tailwind-v4-upgrade

Conversation

@Simrayz
Copy link
Contributor

@Simrayz Simrayz commented Jan 14, 2026

Scope and purpose

Resolves #1262

This PR upgrades the frontend styling from Tailwind CSS v3 to v4 and DaisyUI v4 to v5.

  • New CSS-first config format (replaces JS config)
  • Updated color variable syntax throughout
  • Compatibility fixes for DaisyUI v5 (badges, tabs, tables, forms, dropdowns, tooltips)
  • Fixed filter dropdowns not triggering htmx requests
  • Fixed tooltip alignment causing horizontal scroll on incident table

NOTE: Most changes are straightforward (class renames, variable syntax). The compatibility CSS in 12-daisy-compat.css restores v4 styling where v5 changed defaults we want to keep

How to test

  • After checking out the branch, make sure to run make upgrade-tailwind and make tailwind (should already be commited, but just in case)
  • Start the server, and make sure to refresh the browser (and maybe hard refresh) to get the new stylesheet
  • Click around and see if anything looks strange. During development I had https://argus.uninett.no/ open in a split view, so I could compare directly what the differences were.

Contributor Checklist

Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to Argus can be found in the
Development docs.

  • Added a changelog fragment for towncrier
  • Added/amended tests for new/changed code
  • Added/changed documentation, including updates to the user manual if feature flow or UI is considerably changed
  • Linted/formatted the code with ruff and djLint, easiest by using pre-commit
  • The first line of the commit message continues the sentence "If applied, this commit will ...", starts with a capital letter, does not end with punctuation and is 50 characters or less long. See our how-to
  • If applicable: Created new issues if this PR does not fix the issue completely/there is further work to be done
  • If this results in changes in the UI: Added screenshots of the before and after
  • If this results in changes to the database model: Updated the ER diagram

@Simrayz Simrayz added the CSS label Jan 14, 2026
@CLAassistant
Copy link

CLAassistant commented Jan 14, 2026

CLA assistant check
All committers have signed the CLA.

@Simrayz Simrayz added design frontend Affects frontend theme Theme-dependent frontend problems labels Jan 14, 2026
@Simrayz Simrayz self-assigned this Jan 14, 2026
@Simrayz Simrayz force-pushed the chore/1262-tailwind-v4-upgrade branch from d2899f9 to 5d7240b Compare January 14, 2026 12:21
@github-actions
Copy link

github-actions bot commented Jan 14, 2026

Test results

    6 files    828 suites   1m 39s ⏱️
  655 tests   654 ✅ 1 💤 0 ❌
3 930 runs  3 924 ✅ 6 💤 0 ❌

Results for commit 754f81e.

♻️ This comment has been updated with latest results.

@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

❌ Patch coverage is 23.33333% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.75%. Comparing base (05d530d) to head (754f81e).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
.../argus/htmx/management/commands/tailwind_config.py 0.00% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1723      +/-   ##
==========================================
+ Coverage   80.16%   80.75%   +0.58%     
==========================================
  Files         135      132       -3     
  Lines        6318     6323       +5     
==========================================
+ Hits         5065     5106      +41     
+ Misses       1253     1217      -36     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Simrayz Simrayz requested a review from a team January 14, 2026 12:56
@Simrayz
Copy link
Contributor Author

Simrayz commented Jan 14, 2026

SonarQube is not happy with the new Tailwind directives (@source, @plugin). Should probably add them to the ignore list? (I don't have access)

@Simrayz Simrayz force-pushed the chore/1262-tailwind-v4-upgrade branch from 5d7240b to 8032875 Compare January 14, 2026 13:19
Copy link
Contributor

@hmpf hmpf left a comment

Choose a reason for hiding this comment

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

It's a draft, this is the easily noticeable problems:

Global header:

  • the horizontal lines in the user menu are too long and split into two parts
    image

User preferences:

  • Argus theme is missing from drop down and I get the warning "2026-01-14 14:28:45,660 argus.htmx.themes.utils WARNING Themes in settings are out of sync with themes installed"

    image

Nothing seems to be broken in the styleguide. Nothing else looks weird except the dark theme has even worse contrast than before.

@hmpf
Copy link
Contributor

hmpf commented Jan 14, 2026

Also, it appears that djlint at github-actions differs from the version run by precommit 😮‍💨

@Simrayz Simrayz force-pushed the chore/1262-tailwind-v4-upgrade branch from 8032875 to f829de4 Compare January 14, 2026 13:38
@Simrayz
Copy link
Contributor Author

Simrayz commented Jan 14, 2026

It's a draft, this is the easily noticeable problems:

Global header:

  • the horizontal lines in the user menu are too long

They're the same length to me, but split in two, which I'll fix

image

Dashboard:

The tabs and dropdowns should be fixed, as I spent quite some time fixing them:

image image

Are you using the correct tailwind-cli, generated css and did a hard refresh etc?

User preferences:

  • Argus theme is missing from drop down and I get the warning "2026-01-14 14:28:45,660 argus.htmx.themes.utils WARNING Themes in settings are out of sync with themes installed"

Nothing seems to be broken in the styleguide. Nothing else looks weird except the dark theme has even worse contrast than before.

I'll look into fixing the broken Argus theme, and do some adjustments to make the dark theme to look as expected again.

@Simrayz Simrayz force-pushed the chore/1262-tailwind-v4-upgrade branch 3 times, most recently from f45543e to cd5152c Compare January 15, 2026 08:35
@Simrayz Simrayz requested a review from hmpf January 15, 2026 08:37
@Simrayz Simrayz force-pushed the chore/1262-tailwind-v4-upgrade branch from cd5152c to 9ee9e0e Compare January 15, 2026 08:42
@Simrayz
Copy link
Contributor Author

Simrayz commented Jan 15, 2026

I have addressed the problems identified in the first quick-pass:

  • The argus theme is now included as an option in the theme preferences. The problem was a broken regex.
  • The dividers in the user menu are fixed to have the proper length, padding and remove a space (Daisy started using a grid layout in the user menu, which made the divider split in two due to ::before and ::after being its components).

@Simrayz Simrayz requested a review from a team January 15, 2026 08:57
@Simrayz Simrayz marked this pull request as ready for review January 15, 2026 08:57
@hmpf
Copy link
Contributor

hmpf commented Jan 15, 2026

I see this now... anyone else?

image

@hmpf
Copy link
Contributor

hmpf commented Jan 15, 2026

The border is so discreet it annoys the eyes.

image

In comparison:

image

@Simrayz
Copy link
Contributor Author

Simrayz commented Jan 15, 2026

The border is so discreet it annoys the eyes.

image

Daisy just made their base-colors quite unusable... but I increased it to base-300 instead. Does that work for you?

image

@Simrayz
Copy link
Contributor Author

Simrayz commented Jan 15, 2026

I see this now... anyone else?

image

It only happens when the version number is so long that it does'nt fit, causing the menu to overflow. Shouldn't be an issue in a non-developer environment, but looking into it now 👀

@@ -1,5 +1,5 @@
.card-base {
@apply border border-base-200 bg-base-100;
@apply border border-base-300 bg-base-100;
Copy link
Contributor

Choose a reason for hiding this comment

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

Excellent

<div class="relative isolate flex justify-center gap-x-4 overflow-hidden bg-red-700 px-4 py-1.5">
<div class="absolute left-[max(-7rem,calc(50%-52rem))] top-1/2 -z-10 -translate-y-1/2 transform-gpu blur-2xl"
aria-hidden="true">
<div class="aspect-[577/310] w-[36.0625rem] bg-gradient-to-r from-red-100 to-red-950 opacity-30"
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the purpose of this entire div (one of two even)? The banner message seems to be working just fine without it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure, I just changed the class from bg-gradier-* to bg-linear-* to match the new Tailwind spec

@Simrayz Simrayz force-pushed the chore/1262-tailwind-v4-upgrade branch 2 times, most recently from a2c7bae to b24d8cc Compare January 16, 2026 14:13
@Simrayz Simrayz requested a review from hmpf January 16, 2026 18:23
@Simrayz Simrayz force-pushed the chore/1262-tailwind-v4-upgrade branch from b24d8cc to a1971d5 Compare January 16, 2026 18:59
@Simrayz
Copy link
Contributor Author

Simrayz commented Jan 19, 2026

@hmpf I have added fixes for theme generation, and also had to make some minor changes to how the severity colors are handled. The relevant commits are:

  • f5fcbc9 Upgrade to Tailwind v4 and DaisyUI v5:
    • Updated the management command in tailwind_config.py to generate theme stylesheets from either the config variable (DAISYUI_THEMES) or use the files in the /themes folder (which changes from being intermingled with other sheets in /snippets)
    • All themes are now generated to /themes, and is where all theme files should be put manually as well.
    • Use color variables for severity colors, to avoid purging the classes.
  • ba0c41c Improve theme utils and update documentation for DaisyUI v5
    • Updated the documentation to describe how the new theme generation process works.
    • Incorporated the utility function/variable name changes from the other branch
  • a1971d5 Add severity utility classes for dynamic template usage
    • The variables were added in f5fcbc9, but this PR adds utility classes for bg and text variables.

@Simrayz Simrayz requested a review from a team January 19, 2026 07:56
Copy link
Contributor

@hmpf hmpf left a comment

Choose a reason for hiding this comment

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

Looks good, I'll do a manual test with a new theme to check that bit.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would mention this file in the docs, for ppl that want to swap out the severity colors.

Copy link
Contributor

Choose a reason for hiding this comment

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

.. and that the severity color variables could also be overridden in themes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done 🙂 Also changed documentation regarding tailwind overrides, as Tailwind V4 requires defining these as css variables instead of as config.

@hmpf hmpf added the needs NOTES NOTES.md must be updated for release label Jan 19, 2026
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@hmpf hmpf requested a review from a team January 21, 2026 13:36
@johannaengland johannaengland requested a review from hmpf January 22, 2026 11:59
Copy link
Contributor

@johannaengland johannaengland left a comment

Choose a reason for hiding this comment

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

Highlighting which incident we're hovering over disappear in this PR:
Before:
image

After:
image

The lines between the footer elements are barely visible:
Before:
image

After:
image

Not sure how relevant it is, but the line thickness between the different segments in the user dropdown changes:
Before:
image

After:
image

The button color in the user preference page changes (when they are greyed out):
Before:
image

After:
image

The line grouping time recurrences on the timeslots page is much less visible:
Before:
image

After:
image

==================

How to customize the look:
How to choose which themes to be made available
Copy link
Contributor

Choose a reason for hiding this comment

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

It is a bit unclear to me what "to be made available" means

1. Make sure the browser is in light mode if making a light theme, or dark mode
if making a dark theme.
2. Choose a name that is pure ASCII, and don't reuse any of the names that
comes pre-configured. Save the generated CSS to some file.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
comes pre-configured. Save the generated CSS to some file.
come pre-configured. Save the generated CSS to a file.

--noise: 0;
}

The stuff starting with ``--`` is css-variables.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The stuff starting with ``--`` is css-variables.
The lines starting with ``--`` are css-variables.


The stuff starting with ``--`` is css-variables.

There are two different methods to install generated themes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
There are two different methods to install generated themes.
There are two different methods to install generated themes:

},
]

Make the above one of the entries in the :setting:`DAISYUI_THEMES` setting and
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't really make sense, since the example is a whole DAISYUI_THEMES

result = get_theme_names()
self.assertEqual(result, set(theme_names_from_setting))

def test_get_theme_names_if_theme_missing_may_raise_exception(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def test_get_theme_names_if_theme_missing_may_raise_exception(self):
def test_get_theme_names_if_theme_missing_will_raise_exception(self):

@hmpf
Copy link
Contributor

hmpf commented Jan 26, 2026

SonarQube is not happy with the new Tailwind directives (@source, @plugin). Should probably add them to the ignore list? (I don't have access)

I noticed. I'll see if I can figure out how. We could also try suffixing the template css files with something else than .css?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CSS design frontend Affects frontend needs NOTES NOTES.md must be updated for release rc-future theme Theme-dependent frontend problems

Projects

Status: Changes requested

Development

Successfully merging this pull request may close these issues.

Idea: Change to use tailwind v4

4 participants