Skip to main content

label

Label

from dara.components.common.label import Label

class Label(ContentComponent)

Label

The Label component accepts a label, which will be placed either above or next to the child component.

Example of a simple Label component:


from dara.components.common import Label, Input

Label(
Input(),
value='My Input:',
direction='horizontal',
)

For further customization you can also pass a ComponentInstance to the value param:


from dara.components.common import Label, Input, Text

Label(
Input(),
value=Heading('My Input:', level=2),
direction='horizontal',
)

Arguments:

  • value: A label to be presented with the child component, accepts a string or ComponentInstance
  • direction: Whether to place the label horizontally (next to the component), or vertically (above the component)
  • label_width: A optional string containing the width the label should take

Attributes

  • value: Union[str, ComponentInstance]
  • direction: Direction
  • label_width: Optional[str]