Common Props
This page contains a detailed API reference for the Litho's component common props. It assumes youβre familiar with fundamental Litho concepts, such as LayoutSpecs, Props, and State. If youβre not, read them first.
Propsβ
AccessibilityRoleAccessibilityRoleDescriptionAlignSelfAlphaAspectRatioBackgroundBorderClickHandlerClickableClipChildrenClipToOutlineContentDescriptionDispatchPopulateAccessibilityEventHandlerDuplicateParentStateEnabledStateFlexFlexBasisPercentFlexBasisPxFlexGrowFlexShrinkFocusChangeHandlerFocusStateFocusedHandlerForegroundFullImpressionHandlerHeightPercentHeightPxImportantForAccessibilityInterceptTouchHandlerInvisibleHandlerIsReferenceBaselineLayoutDirectionLongClickHandlerMarginAutosMarginPercentsMarginsMaxHeightPercentMaxHeightPxMaxWidthPercentMaxWidthPxMinHeightPercentMinHeightPxMinWidthPercentMinWidthPxOnInitializeAccessibilityEventHandlerOnInitializeAccessibilityNodeInfoHandlerOnPopulateAccessibilityEventHandlerOnRequestSendAccessibilityEventHandlerOutlineProviderPaddingPercentsPaddingsPerformAccessibilityActionHandlerPositionPercentsPositionTypePositionsRotationRotationXRotationYScaleSelectedStateSendAccessibilityEventHandlerSendAccessibilityEventUncheckedHandlerShadowElevationStateListAnimatorStateListAnimatorResTouchExpansionsTouchHandlerTransitionKeyTransitionKeyTypeUnfocusedHandlerUseHeightAsBaselineViewTagViewTagsVisibilityChangedHandlerVisibleHandlerVisibleHeightRatioVisibleWidthRatioWidthPercentWidthPx
Referenceβ
AccessibilityRoleβ
{...}
AccessibilityRoleDescriptionβ
{...}
AlignSelfβ
{...}
Alphaβ
{...}
AspectRatioβ
{...}
Backgroundβ
Sets the background of the component; pass a ComparableDrawable to make subsequent mounting more efficient.
MyComponent.create(c)
.background(new ComparableGradientDrawable())
Use the utility methods to set a background color or use an android resource id.
Component#backgroundAttr(@AttrRes int)Component#backgroundColor(@ColorInt int)Component#backgroundRes(@DrawableRes int)Component#background(Drawable)(deprecated)
Borderβ
Sets a border on the component.
MyComponent.create(c)
.border(
Border.create(c)
.color(YogaEdge.LEFT, Color.RED)
.color(YogaEdge.TOP, 0xFFFFFF00)
.color(YogaEdge.RIGHT, 0xFFFFFFFF)
.color(YogaEdge.BOTTOM, 0xFFFF00FF)
.widthDip(YogaEdge.ALL, 4)
.build()
)
ClickHandlerβ
Sets a click handler on the component.
MyComponent.create(c)
.clickHandler(RootComponent.onSomeEvent(c))
See: Event Handling docs for more info.
Clickableβ
Defines whether this component reacts to click events. The default value is inherited from its Android View.
MyComponent.create(c)
.clickable(true)
ClipChildrenβ
Defines whether a children of given component are limited to draw inside of its bounds or not. The
default value of this property is true.
MyComponent.create(c)
.clipChildren(true)
ClipToOutlineβ
{...}
ContentDescriptionβ
{...}
DispatchPopulateAccessibilityEventHandlerβ
{...}
DuplicateParentStateβ
{...}
EnabledStateβ
{...}
Flexβ
{...}
FlexBasisPercentβ
{...}
FlexBasisPxβ
{...}
FlexGrowβ
{...}
FlexShrinkβ
{...}
FocusChangeHandlerβ
{...}
FocusStateβ
{...}
FocusedHandlerβ
{...}
Foregroundβ
{...}
FullImpressionHandlerβ
{...}
HeightPercentβ
{...}
HeightPxβ
{...}
ImportantForAccessibilityβ
{...}
InterceptTouchHandlerβ
{...}
InvisibleHandlerβ
{...}
IsReferenceBaselineβ
{...}
LayoutDirectionβ
{...}
LongClickHandlerβ
{...}
MarginAutosβ
{...}
MarginPercentsβ
{...}
Marginsβ
{...}
MaxHeightPercentβ
{...}
MaxHeightPxβ
{...}
MaxWidthPercentβ
{...}
MaxWidthPxβ
{...}
MinHeightPercentβ
{...}
MinHeightPxβ
{...}
MinWidthPercentβ
{...}
MinWidthPxβ
{...}
OnInitializeAccessibilityEventHandlerβ
{...}
OnInitializeAccessibilityNodeInfoHandlerβ
{...}
OnPopulateAccessibilityEventHandlerβ
{...}
OnRequestSendAccessibilityEventHandlerβ
{...}
OutlineProviderβ
{...}
PaddingPercentsβ
{...}
Paddingsβ
{...}
PerformAccessibilityActionHandlerβ
{...}
PositionPercentsβ
{...}
PositionTypeβ
{...}
Positionsβ
{...}
Rotationβ
{...}
RotationXβ
{...}
RotationYβ
{...}
Scaleβ
{...}
SelectedStateβ
{...}
SendAccessibilityEventHandlerβ
{...}
SendAccessibilityEventUncheckedHandlerβ
{...}
ShadowElevationβ
{...}
StateListAnimatorβ
{...}
StateListAnimatorResβ
{...}
TouchExpansionsβ
{...}
TouchHandlerβ
{...}
TransitionKeyβ
{...}
TransitionKeyTypeβ
{...}
UnfocusedHandlerβ
{...}
UseHeightAsBaselineβ
{...}
ViewTagβ
{...}
ViewTagsβ
{...}
VisibilityChangedHandlerβ
{...}
VisibleHandlerβ
{...}
VisibleHeightRatioβ
{...}
VisibleWidthRatioβ
{...}
WidthPercentβ
{...}
WidthPxβ
{...}