Modifier As First Optional Param
Every component composable that emits layout exposes a `modifier: Modifier = Modifier` parameter. It comes after all required parameters and before all other optional ones.…
$ prime install @android-compose/rule-modifier-as-first-optional-param Projection
Always in _index.xml · the agent never has to ask for this.
ModifierAsFirstOptionalParam [rule] v0.1.0
Every component composable that emits layout exposes a modifier: Modifier = Modifier parameter. It comes after all required parameters and before all other optional ones. The modifier is applied to the ROOT element of the component's emitted layout — never to an inner child. This convention lets the caller adjust size, padding, click behaviour, semantics, or test tags from the outside without the component having to anticipate every possible adjustment.
Loaded when retrieval picks the atom as adjacent / supporting.
ModifierAsFirstOptionalParam [rule] v0.1.0
Every component composable that emits layout exposes a modifier: Modifier = Modifier parameter. It comes after all required parameters and before all other optional ones. The modifier is applied to the ROOT element of the component's emitted layout — never to an inner child. This convention lets the caller adjust size, padding, click behaviour, semantics, or test tags from the outside without the component having to anticipate every possible adjustment.
Checks
- Signature ends like:
Component(required1, required2, modifier: Modifier = Modifier, optionalA = ..., optionalB = ...). -
modifierdefaults toModifier(the empty modifier), never to a non-empty value with built-in padding or size. - Internally, the modifier is forwarded to the outermost layout:
Box(modifier = modifier) { ... }. Inner padding usesModifier.padding(...)chained AFTER, e.g.Box(modifier.padding(8.dp)). - Components do not accept multiple modifier parameters; if an inner element needs styling, expose a slot or a typed parameter, not a second Modifier.
Label
modifier: Modifier = Modifier is the first optional parameter
Loaded when retrieval picks the atom as a focal / direct hit.
ModifierAsFirstOptionalParam [rule] v0.1.0
Every component composable that emits layout exposes a modifier: Modifier = Modifier parameter. It comes after all required parameters and before all other optional ones. The modifier is applied to the ROOT element of the component's emitted layout — never to an inner child. This convention lets the caller adjust size, padding, click behaviour, semantics, or test tags from the outside without the component having to anticipate every possible adjustment.
Checks
- Signature ends like:
Component(required1, required2, modifier: Modifier = Modifier, optionalA = ..., optionalB = ...). -
modifierdefaults toModifier(the empty modifier), never to a non-empty value with built-in padding or size. - Internally, the modifier is forwarded to the outermost layout:
Box(modifier = modifier) { ... }. Inner padding usesModifier.padding(...)chained AFTER, e.g.Box(modifier.padding(8.dp)). - Components do not accept multiple modifier parameters; if an inner element needs styling, expose a slot or a typed parameter, not a second Modifier.
Label
modifier: Modifier = Modifier is the first optional parameter
Label
modifier: Modifier = Modifier is the first optional parameter
Source
prime-system/examples/android-compose/primes/compiled/@android-compose/rule-modifier-as-first-optional-param/atom.yaml