diff --git a/dev/concepts/fundamentals/component_defaults/index.html b/dev/concepts/fundamentals/component_defaults/index.html index 0adb4c17..4d879016 100644 --- a/dev/concepts/fundamentals/component_defaults/index.html +++ b/dev/concepts/fundamentals/component_defaults/index.html @@ -21,7 +21,7 @@ "selected_items": None, }, ) -
Notice that we've set selected_items
to None
. None
values are treated as missing values, and so selected_items
will be set to [1, 2, 3]
.
Warning
The defaults are aplied only to keyword arguments. They are NOT applied to positional arguments!
Warning
When typing your components with Args
, Kwargs
, or Slots
classes, you may be inclined to define the defaults in the classes.
Notice that we've set selected_items
to None
. None
values are treated as missing values, and so selected_items
will be set to [1, 2, 3]
.
Warning
The defaults are aplied only to keyword arguments. They are NOT applied to positional arguments!
Warning
When typing your components with Args
, Kwargs
, or Slots
classes, you may be inclined to define the defaults in the classes.
This is NOT recommended, because:
self.input
property.None
.Instead, define the defaults in the Defaults
class.
For objects such as lists, dictionaries or other instances, you have to be careful - if you simply set a default value, this instance will be shared across all instances of the component!
We can access individual defaults like this: