## Set the view on the embedded form `checkoutForm.setView(viewIndex: number)` > This feature is in private preview. See [Embedded form](https://docs.stripe.com/checkout/how-checkout-works.md?payment-ui=checkout-form) for more information. Programmatically sets the active view on the embedded form. This method is only available when `options[layout]` is `'compact'`. The `viewIndex` parameter is a positive integer that corresponds to an index from the `views` array provided on the embedded form's [change event](https://docs.stripe.com/js/custom_checkout/element_events/on_change.md?type=checkoutForm). You can only set a view where `enabled` is `true`. - `viewIndex` A positive integer index corresponding to an entry in the `views` array provided on the embedded form's [change event](https://docs.stripe.com/js/custom_checkout/element_events/on_change.md?type=checkoutForm). The view at the specified index must have `enabled: true`. ### Example ```title Set the view on the embedded form ```