Files
vault/ui/lib/core/stories/ttl-picker2.md
Alexander Scheel ee1e5bec5b Update repository links to point to main (#14112)
* Update repository links to point to main

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>

* Fix broken link in relatedtools.mdx

Co-authored-by: Steven Clark <steven.clark@hashicorp.com>

Co-authored-by: Steven Clark <steven.clark@hashicorp.com>
2022-02-17 14:30:56 -05:00

3.9 KiB

TtlPicker2

TtlPicker2 components are used to enable and select time to live values. Use this TtlPicker2 instead of TtlPicker if you:

  • Want the TTL to be enabled or disabled
  • Want to have the time recalculated by default when the unit changes (eg 60s -> 1m)

Params

Param Type Default Description
onChange function This function will be passed a TTL object, which includes enabled{bool}, seconds{number}, timeString{string}.
label String "Time to live (TTL)" Label is the main label that lives next to the toggle.
helperTextDisabled String "Allow tokens to be used indefinitely" This helper text is shown under the label when the toggle is switched off
helperTextEnabled String "Disable the use of the token after" This helper text is shown under the label when the toggle is switched on
description Longer description about this value, what it does, and why it is useful. Shows up in tooltip next to helpertext
time Number 30 The time (in the default units) which will be adjustable by the user of the form
unit String "s" This is the unit key which will show by default on the form. Can be one of s (seconds), m (minutes), h (hours), d (days)
recalculationTimeout Number 5000 This is the time, in milliseconds, that recalculateSeconds will be be true after time is updated
initialValue String This is the value set initially (particularly from a string like '30h')
initialEnabled Boolean Set this value if you want the toggle on when component is mounted
changeOnInit Boolean false set this value if you'd like the passed onChange function to be called on component initialization

Example

<TtlPicker2 @onChange={{handleChange}} @time={{defaultTime}} @unit={{defaultUnit}}/>

See