VoidhashDocs
DevelopersHelp centerGuidesAPI reference
Dashboard
Get started
Introduction
Quickstart
How Voidhash works
Glossary
Versions and releases
Concepts
Teams, projects and environments
API keys
Products and perks
Offers
Subscription lifecycle
People and identity
Groups
Events
Features
Paywalls in your app
Feature flags and A/B tests
Paywall components
Push notifications
Ad attribution in your app
Client SDKs
React Native
Swift
Kotlin
Web
Your backend
Node.js
PHP
Go
Rust
Other languages
Payment sources
Forward store notifications
Developer tools
CLI
MCP server
Query analytics with VoidQL
Components
Develop a component
Editor panels
Panel handlers and state
Component definition
Component props
Publishing
Installing and capabilities

Component props

The settings a component exposes in the paywall designer, declared in component.json and in Rust.

Props are the settings the paywall designer shows for each instance of a component. Declare them in the component definition and as parameters of the #[component] function.

Fields

Each prop in component.json has a name, a type and a default. The designer reads the other fields to show it well:

FieldMeaning
titleThe prop's label. Defaults to its name.
descriptionA sentence about what it does.
groupA heading the prop is shown under. Props without one come first.
visibleWhenShows the prop only while another prop has a value: { "kind": "equals", "prop": "style", "value": "ring" }, or oneOf with values.
bindableWhether the prop can take a variable instead of a value. On for scalar props, those of every type but object and list, unless set false.
localizableWhether the prop has a value per locale, for translated paywalls. Props of any kind can.

Types

The type sets what the prop holds and the control the designer shows for it:

TypeValue
stringText. multiline shows a larger field; maxLength limits its length.
numberA number. min, max and step shape the field; unit is px, %, s, deg or x.
booleanOn or off.
enumOne of its options: [{ "value": "ring", "title": "Ring" }]. An option can add an icon.
colorA hex color, such as #7c3aed.
fillA color or fill the component paints with.
assetAn image from the project's assets: { "kind": "asset", "accepts": ["image"] }.
productOne of the project's products.
objectA group of fields, each a prop of its own.
listA list of another type: { "kind": "list", "of": { "kind": "product" } }. maxItems caps it.

Props in Rust

Every parameter after cx in a #[component] function is a prop. Its name is the parameter's name in camelCase, and its type follows the Rust type: String, numbers, bool, Color, Fill, Image or Asset, Product or ProductId, an enum deriving PropEnum, and Option or Vec of those. #[prop(…)] sets the rest:

pub fn Countdown(
    cx: Cx,
    #[prop(default = 900, min = 0, max = 3600, step = 1, unit = "s", group = "Timing")]
    duration: f64,
    #[prop(title = "Headline", localizable, max_length = 40)] title: String,
    #[prop(accepts(image))] badge: Asset,
    #[prop(visible_when(prop = "style", equals = "ring"))] thickness: f64,
    #[prop(max_items = 4)] features: Vec<String>,
    style: Style,
) -> View

An enum deriving PropEnum becomes an enum prop with one option per variant. Name each option with #[prop_enum(title = "…")] when its variant name does not read well.

Publishing checks that the props in component.json match these.

Next steps

  • Component definition
  • Add an editor panel
  • Develop a component

Something wrong or missing on this page? Tell us by email or on Discord.

PreviousComponent definitionNextPublishing

On this page

FieldsTypesProps in RustNext steps