---
name: "Tickit::WidgetRole::SingleChildContainer"
section: "3pm"
platform: "linux"
package: "libtickit-widgets-perl"
version: "0.42-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Tickit::WidgetRole::SingleChildContainer"
---

# Tickit::WidgetRole::SingleChildContainer(3pm)

role for widgets that contain a single other widget

## NAME

"Tickit::WidgetRole::SingleChildContainer" - role for widgets that contain a single other widget

## SYNOPSIS

```
   class Some::Widget::Class
      :isa(Tickit::Widget)
      :does(Tickit::WidgetRole::SingleChildContainer);
   ...
```

## DESCRIPTION

Applying this role to a Tickit::Widget subclass adds behaviour for it to act as a container widget holding a single child widget.

## METHODS

### child

```
   $child = $widget->child;
```

Returns the contained child widget.

### set\_child

```
   $widget->set_child( $child );
```

Sets the child widget, or `"undef"` to remove.

This method returns the container widget instance itself making it suitable to use as a chaining mutator; e.g.

```
   my $container = Tickit::SingleChildWidget->new( ... )
      ->set_child( Tickit::Widget::Static->new( ... ) );
```

## AUTHOR

Paul Evans \<leonerd@leonerd.org.uk\>
