Reflex Cloud - Fast, secure & scalable hosting. One command to deploy.

Responsive

Reflex apps can be made responsive to look good on mobile, tablet, and desktop.

You can pass a list of values to any style property to specify its value on different screen sizes.

Hello World

The text will change color based on your screen size. If you are on desktop, try changing the size of your browser window to see the color change.

New in 0.5.6

Responsive values can also be specified using rx.breakpoints. Each size maps to a corresponding key, the value of which will be applied when the screen size is greater than or equal to the named breakpoint.

Hello World

Custom breakpoints in CSS units can be mapped to values per component using a dictionary instead of named parameters.

For the Radix UI components' fields that supports responsive value, you can also use rx.breakpoints (note that custom breakpoints and list syntax aren't supported).

Setting Defaults

The default breakpoints are shown below.

SizeWidth
initial0px
xs30em
sm48em
md62em
lg80em
xl96em

You can customize them using the style property.

Showing Components Based on Display

A common use case for responsive is to show different components based on the screen size.

Reflex provides useful helper components for this.

Desktop View

Tablet View

Mobile View

Visible on Mobile and Tablet

Visible on Desktop and Tablet

Specifying Display Breakpoints

You can specify the breakpoints to use for the responsive components by using the display style property.

Hello World

Hello World

Hello World

Hello World

Hello World