Rock Mobile Docs
App Factory
  • Welcome 👋
  • 📱Getting Started
    • Building Your First App
      • Creating An App
      • App Configuration
      • Adding Content
      • Deploying Your App
    • Lexicon
  • 🧱Essentials
    • Animations
    • Blocks
      • CMS
        • Content
        • Content Channel Item View
        • Content Collection View
        • Daily Challenge Entry
        • Hero
        • Lava Item List
        • Login
          • Using Auth0
          • Using Entra
        • Profile Details
        • Register
        • Structured Content View
        • Workflow Entry
      • Check-in
        • Check-in
      • Communication
        • Communication Entry
        • Communication List Subscribe
        • Communication View
        • SMS Conversation List
        • SMS Conversation
      • Connection
        • Add Connection Request
        • Connection Type List
        • Connection Opportunity List
        • Connection Request List
        • Connection Request Detail
      • Core
        • Attribute Values
        • Notes
        • Search
        • Smart Search
        • Quick Note
        • My Notes
      • CRM
        • Group Members
        • Person Profile
      • Events
        • Live Experience Occurrences
        • Live Experience
        • Calendar Event Item Occurrence View
        • Calendar Event List
        • Calendar View
        • Event Item Occurrence List By Audience Lava
      • Finance
        • Giving
        • Scheduled Transaction List
        • Transaction Detail
        • Transaction List
      • Groups
        • Group Attendance Entry
        • Group Edit
        • Group Finder
        • Group Member Edit
        • Group Member List
        • Group Member View
        • Group Registration
        • Group View
        • Schedule Preference
        • Schedule Sign Up
        • Schedule Toolbox
        • Schedule Unavailability
      • Prayer
        • Answer To Prayer
        • My Prayer Requests
        • Prayer Card View
        • Prayer Request Details
        • Prayer Session
        • Prayer Session Setup
      • Reminders
        • Reminder Edit
        • Reminder List
        • Reminder Dashboard
      • Security
        • Onboard Person
    • Codex
      • Application Strategy
      • XAML Styling
      • Resources
      • Documentation
    • Commands
      • Communication Commands
      • Navigation Commands
      • Media Commands
      • Utility Commands
    • Controls
      • Behaviors
        • Event To Command Behavior
        • Touch Behavior
      • Content Controls
        • Activity Indicator
        • Application Info
        • Avatar
        • Bible Audio
        • Bible Browser
        • Bible Reader
        • Campus Context Picker
          • Camera Code Reader
        • Cards
          • Block Card
          • Contained Card
          • Inline Card
          • Elements of a Card
          • Masks
          • Styling Cards With CSS
        • Context Menu
        • Countdown
        • Cover Sheet
        • Divider
        • Expander
        • Field Container
        • Flip View
        • Following Icon
        • Geo Boundary View
        • HTML
        • Icon
        • Icon Button
        • Image
        • Interaction
        • Items Collection
        • Login Status
        • Login Status Photo
        • Lottie View
        • Markdown
        • Media Player
          • Legacy
        • Notification Box
        • Paragraph Text
        • QR Code
        • Ratio View
        • Redirect
        • Responsive Column
        • Responsive Layout
        • Scroll View
        • Segment Picker
        • Styled Border
        • Styled View
        • Tag
        • Toggle Button
        • Web View
      • Developer Controls
        • Execute Command
        • Bible Book And Chapter Picker
        • Command Reference
        • Field Stack
        • Media Cast Button
        • Media Progress Bar
        • Parameter
        • Scan Code
        • Validator
        • Volume Control
        • Zone
      • Effects
        • Blur Effect
        • Safe Area Padding Effect
      • Form Fields
        • Attribute Value Editor
        • Address
        • Campus Picker
        • Check Box
        • Check Box List
        • Currency Box
        • Date Picker
        • Email Box
        • Literal
        • Marital Status Picker
        • Multi Picker
        • Number Box
        • Phone Number Box
        • Picker
        • Text Box
        • Text Editor
      • XAML Extensions
        • Boolean Value Converter
        • From Json
        • Inverse Boolean Converter
        • Nullable Guid Converter
        • On Device Platform
        • On Device Type
        • Palette Color
        • Seconds To Time String Converter
    • Field Types
    • Lava
      • Context in Lava
    • Performance
    • Tips and Tricks
      • Custom Site Attributes
      • Migrating to .NET MAUI (V6)
      • Page Anchors
    • Troubleshooting
    • Advanced Topics
      • Dynamic Content
      • Deep Linking
  • 🎨Styling
    • Introduction
    • Style Guide
      • Walkthrough
      • Colors
      • Typography
      • Utilities
      • Shell Components
      • Migrating
    • Legacy
      • Colors
      • Borders
        • Border Color
        • Border Radius
        • Border Width
      • Text
        • Background Color
        • Text Size
        • Alignment
        • Color
        • Line Height
        • Weights & Styles
      • iOS Shadows
      • Styling Components
        • Tags
        • Bible
        • Button
        • Form Fields
        • Modals
      • Custom CSS
  • 👨‍💻Developers
    • Fundamentals
    • Core & Shell Dependencies
    • Custom Blocks
    • OS Version Requirements
  • 🏭App Factory
    • Overview
    • Android Keystore
    • App Store Product Page
    • Developer Accounts
    • Image Resources
    • In-App Giving
    • Publishing Requirements
    • Push Notifications
    • Rock Logins
    • Shell Update Requirements
Powered by GitBook

Resources

  • Release Notes
  • Community Chat
  • Ask Chip

Documentation

  • Rock Manuals
  • Lava

⚙️ Powered by Rock RMS

On this page
  • Custom Utility Classes
  • Targeting Platforms
  • Targeting Device Types
  • Combining Platform and and Device Types
  • Styling Pages
  • Styling Blocks
  • Styling Controls
  • Combining it All
  • Custom CSS Properties
  • Text Shadow
  • Color Variables
  • Interface & Application Colors
  • Palette Colors
  • Alert Colors
  • Misc Variables
  • Shell CSS Functions
Export as PDF
  1. Styling
  2. Legacy

Custom CSS

Last updated 2 months ago

If the need arises to add CSS inline on a single page, it can be done with the following syntax:

<Grid>
    <Grid.Resources>
        <StyleSheet>
            <![CDATA[
            ^grid {
                background-color: lightgray;
            }
            ]]>
        </StyleSheet>
    </Grid.Resources>
</Grid>

In most cases though, it's recommended to add custom styles globally to your app in the Styles tab of the application settings under the Advanced Options section. This allows styles to be defined once and accessible from any page within the app.

Here you can add custom classes, target specific views, etc. There are several custom variables you can use in your CSS to represent colors and settings. These variables are listed below.

Custom Utility Classes

Rock Mobile provides a set of utility class selectors to help target your styling to specific platforms, device types, pages, and blocks. Each is discussed below.

Targeting Platforms

If you need to target styling to a specific platform (iOS or Android) you can use the parent classes .ios or .android.

.ios .heading1 {
    font-size: 33; 
}

Targeting Device Types

Similar to platforms you can also target device types with .phone or .tablet.

.phone .heading1 {
    font-size: 33;
}

Combining Platform and and Device Types

Need to get really specific? You can combine the two classes as shown below. In general, you should try to make your design work without too many of these specific styles.

.ios.phone .heading1 {
    color: red;
}

Styling Pages

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.

.page-aboutus .heading1 {
    font-size: 33;
}

Styling Blocks

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.

.block-calendarview .heading1 {
    font-size: 33;
}

Styling Controls

Each XAML component can also be targeted. The selector for the control is its name in all lowercase. For instance the Label control becomes label , a DatePicker would be datepicker.

If you wanted to style all instances of FieldStack you could use the CSS below.

fieldstack {
    border-color: #c4c4c4;
}

The CSS above would make the border color of all instances of FieldStack a gray color. Many controls in Rock Mobile inherit from other controls. For instance, the Address control inherits from FieldStack. The CSS above would not affect the Address control. If you want all controls that inherit from another control add a ^ in front of the selector. The CSS below would select controls that are a FieldStack or inherit from one.

^fieldstack {
    border-color: #c4c4c4;
}

Combining it All

The example below is not a best practice but shows you how you can use all of the utility classes together if needed. If you find yourself writing these types of CSS rules you're trying to swim upstream and should consider a better styling strategy.

.ios.phone.page-aboutus .block-content .heading1 {
    font-size: 33;
}

Custom CSS Properties

Rock Mobile has a couple of custom CSS properties for use in mobile. These include:

Text Shadow

This property allows you to add a shadow to Labels. The syntax looks like this:

-rock-text-shadow: [distanceX] [distanceY] [blurRadius] [color]

Example:

.hero .hero-title {
    font-size: 24;
    color: white;
    -rock-text-shadow: 2 2 4 black;
}

Color Variables

Unlike normal CSS, referencing an invalid custom variable with the ? syntax will cause the app to crash.

Downhill includes several color variables that you can use in your CSS to reference colors defined in the administrative settings as well as a curated palette of colors that will bring consistency to your application.

Interface & Application Colors

Variable

Value

?color-text

Text Color provided in the Style settings.

?color-heading

Heading Color provided in the Style settings.

?color-primary

Primary Color provided in the Style settings.

?color-secondary

Secondary Color provided in the Style settings.

?color-success

Success Color provided in the Style settings.

?color-danger

Danger Color provided in the Style settings.

?color-warning

Warning Color provided in the Style settings.

?color-light

Light Color provided in the Style settings.

?color-dark

Dark Color provided in the Style settings.

Palette Colors

?color-{color}-{intensity}

Example ?color-orange-400

Alert Colors

Alert boxes are made up of three different colors:

  • Background Color

  • Text Color

  • Border Color

These three colors are generated based on the Bootstrap alert recipe from the application colors above. The patterns for usage are:

?color-{application-color}-{property}

Example

?color-primary-background ?color-primary-border ?color-primary-text

Misc Variables

Unlike normal CSS, referencing an invalid custom variable with the ? syntax will cause the app to crash.

Below are some additional variables you can reference:

Variable

Value

?radius-base

The base radius that is configured.

?spacing-base

The default value to use for margins and padding.

?font-size-default

The default font size.

?color-text

The default color for text.

?color-heading

The default color for use with headings.

?color-background

The default background color.

Shell CSS Functions

Below are some additional items that behave like functions in your CSS. These allow you to run calculations to provide the CSS value.

Function

Usage

Takes the passed in floatValue number and multiplies it by the system font scale. This is usually set by the user in the device accessibility settings.

You can also target specific platforms in XAML with the .

can be referenced with the following notation.

?shell-font-scale(floatValue)

🎨
OnPlatform class
Palette colors