Skip to content

Is there any reasonable way to simulate a narrower window, or dynamically change breakpoints? #482

Answered by dvdsgl
dvdsgl asked this question in Q&A
Discussion options

You must be logged in to vote

We accomplished this by adding responsive-{sm,md,lg,xl,2xl} variants to twin, and manually setting these classes on the pseudo browser, to simulate dynamic responsiveness within a container:

diff --git a/node_modules/twin.macro/macro.js b/node_modules/twin.macro/macro.js
index 8b28d1d..8d1e40b 100644
--- a/node_modules/twin.macro/macro.js
+++ b/node_modules/twin.macro/macro.js
@@ -2690,6 +2690,14 @@ var variantConfig = function (ref) {
    'group-hocus': function (variantData) { return prefixDarkLightModeClass('.group:hover &, .group:focus &', variantData); },
    'group-active': function (variantData) { return prefixDarkLightModeClass('.group:active &', variantData); },
    'group-visite…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@ben-rogerson
Comment options

@rdgr
Comment options

@ben-rogerson
Comment options

@rdgr
Comment options

Answer selected by dvdsgl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants