add optional button to toggle preview
include optional preview button in the second example