Skip to content

Commit 4ee1aba

Browse files
committed
Add a note about priority and defaults to the binding documentation
1 parent b0de5ae commit 4ee1aba

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/guide/input.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,15 @@ Note how the footer displays bindings and makes them clickable.
127127
Multiple keys can be bound to a single action by comma-separating them.
128128
For example, `("r,t", "add_bar('red')", "Add Red")` means both ++r++ and ++t++ are bound to `add_bar('red')`.
129129

130+
131+
!!! note
132+
133+
Ordinarily a binding on a focused widget has precedence over the same key binding at a higher level. However, bindings at the `App` or `Screen` level always have priority.
134+
135+
The priority of a single binding can be controlled with the `priority` parameter of a `Binding` instance. Set it to `True` to give it priority, or `False` to not.
136+
137+
The default priority of all bindings on a class can be controlled with the `PRIORITY_BINDINGS` class variable. Set it to `True` or `False` to set the default priroty for all `BINDINGS`.
138+
130139
### Binding class
131140

132141
The tuple of three strings may be enough for simple bindings, but you can also replace the tuple with a [Binding][textual.binding.Binding] instance which exposes a few more options.

0 commit comments

Comments
 (0)