Transform UI

You can use Gemini to transform UI code within the Compose preview environment using natural language directly in the preview.

To transform UI with Gemini, follow these steps:

  1. In the Compose preview panel, right-click a preview and select Transform UI with Gemini.

    Accessing 'Transform UI with Gemini' menu
  2. Enter your natural language request, such as "Center align these buttons," to guide Gemini in adjusting your layout or styling, or select specific UI elements in the preview for better context.

    Applying a natural language transformation to a Compose preview
  3. Gemini produces a diff with suggested code edits. You can review and further refine the updates if needed before approving the changes.

Try prompts like the following:

  • "Add more spacing between the text"
  • "Make the icons 10% larger"
  • "Change the background color to <color>"

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026年03月11日 UTC.