Utilities
Leverage built-in CSS classes to powerfully style your application.
Last updated
Leverage built-in CSS classes to powerfully style your application.
Last updated
Applies to:
Many elements inherit from and therefore can have margin and padding applied to them. Below are the utility classes for adding margins to your views.
The format for specifying margins is .m{sides}-{size}
and similarly for padding is .p{sides}-{size}
.
Where the sizes are represented as:
t
- top
b
- bottom
l
- left
r
- right
x
- left and right
y
- top and bottom
blank for all
And the size is one of the following:
0
4
8
12
16
24
48
80
This would produce a margin of 16 on all sides.
This would produce a margin and padding of 16 on all sides.
This would produce a margin of 8 on top.
You can apply the following classes to change to opacity of an element.
Class
Properties
.o-0
opacity: 0; (invisible)
.o-10
opacity: .1;
.o-20
opacity: .2;
.o-30
opacity: .3;
.o-40
opacity: .4;
.o-50
opacity: .5;
.o-60
opacity: .6;
.o-70
opacity: .7;
.o-80
opacity: .8;
.o-90
opacity: .9;
The following classes can be used to show/hide an element.
Class
Property
Notes
.visible
visibility: visible;
Display the element.
.invisible
visibility: hidden;
Do not display the element, but reserve space for the element in layout.
.collapse
visibility: collapse;
Do not display the element, and do not reserve space for it in layout.
Applies to StackLayout
The format for specifying spacing is .spacing-{value}
.
Where the values are represented as:
0
4
8
12
16
24
48
80
Applies to Grid and Responsive Layout
The format for specifying row spacing is .gap-row-{value}
.
The format for specifying column spacing is .gap-column-{value}
.
To apply row and column spacing, the format is .gap-{value}
.
Adds a row gap to the grid.
Adds a column gap to the grid.
The following border width classes are provided to help with styling buttons.
Class
.border-0
.border-1
.border-2
.border-3
.border-4
.border-5
The following classes are provided to adjust the radius of borders.
Class
Property
.rounded-sm
border-radius: 4;
.rounded
border-radius: 8;
.rounded-lg
border-radius: 16;
.rounded-full
border-radius: 1000; (not recommended on iOS)
If you need to target styling to a specific platform (iOS or Android) you can use the parent classes .ios
or .android
.
Similar to platforms you can also target device types with .phone
or .tablet
.
When configuring a page you can provide a CSS class you would like to add to the page. This will allow you to scope the styling of elements on that page.
Each Rock mobile block has a CSS class assigned to it. This allows you to target the visual elements within a specific block. The pattern to use is .block-[block type name lowercase]
. For example, the calendar block would be .block-calendarview
.
This property allows you to add a shadow to Labels. The syntax looks like this:
-rock-text-shadow: [distanceX] [distanceY] [blurRadius] [color]
Example:
Applies to:
Applies to
Applies to: , , StyledBorder
Applies to: , , , , StyledBorder