You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google App Maker中Switch复选框样式调整及标签位置设置咨询

Fixing Google App Maker Switch Checkbox Customizations

Got it, let's work through your two checkbox customization needs step by step:

1. Change checked switch knob color to green

Your original CSS target was incorrect because the "Switch" style checkbox hides the native <input> element and uses custom styled elements for the track and knob. Here's the correct CSS to target the active knob:

/* Target the switch thumb when the checkbox is checked */
.app-Checkbox-Input:checked ~ .app-Checkbox-Switch .app-Checkbox-SwitchThumb {
  background-color: green;
  /* Optional: Add transition for smooth color change */
  transition: background-color 0.2s ease;
}

Why this works:

  • The .app-Checkbox-SwitchThumb is the actual visible knob element
  • We use the sibling selector (~) to target the switch container that comes after the hidden checked input
  • Adding a transition makes the color shift feel smoother, which is optional but improves UX

2. Move label to the left of the switch

This can be done by adjusting the flex layout of the checkbox container. Add this CSS to reverse the order of elements:

/* Reverse the flex order for switch-style checkboxes */
.app-Checkbox--Switch {
  flex-direction: row-reverse;
  justify-content: flex-end; /* Preserves default spacing between label and switch */
}

Notes:

  • Using .app-Checkbox--Switch ensures this only affects checkboxes set to "Switch" style (instead of all checkboxes)
  • justify-content: flex-end keeps the spacing between the label and switch consistent with the default layout, so things don't look misaligned

Make sure to add these CSS rules in your App Maker project's Custom CSS section (either globally under App Settings, or on specific pages if you only want this to apply there).

内容的提问来源于stack exchange,提问作者Johan W.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 08:36:04