← All proposals

Agentic Split Button

A separate component, `AgenticSplitButton`, a copy of the PDS v2 Split Button, so the engineer's port is mostly a copy:

Extends a PDS componentOpen in Storybook

proposals/AgenticSplitButton/agentic-split-button.css75 lines · View on GitHub
/* Split Button, `variant='agentic'`: the only new part. The wrapper also has
   `.pds-split-button--secondary`, so everything else (the separator, the
   rounded outer corners, the hidden tally and status dot) is the package's
   `split-button.css`. The AI gradient is the border around the whole control,
   as on the agentic Button. A gradient cannot go in
   border-color, so the wrapper's border is transparent, the gradient is
   painted on its border-box and the fill layers sit on the padding-box above
   it. The secondary background token is translucent, so an opaque surface
   layer keeps the gradient from showing through the middle. The halves lose
   their own borders, and are 2 border widths shorter so the control matches
   the height of a standalone Button. */
.pds-split-button--agentic {
	--split-button-fill: var(--pds-color-button-secondary-background-default);

	background-clip: padding-box, padding-box, border-box;
	background-color: transparent;
	background-image:
		linear-gradient(var(--split-button-fill), var(--split-button-fill)),
		linear-gradient(
			var(--pds-color-surface-default),
			var(--pds-color-surface-default)
		),
		var(--pds-gradient-ai-active);
	background-origin: border-box;
	border: var(--pds-border-width-default) solid transparent;
}

.pds-split-button--agentic button.pds-split-button__primary-action,
.pds-split-button--agentic button.pds-menu-button__trigger {
	border: 0;
}

.pds-split-button--agentic .pds-button--s {
	--button-height: calc(
		var(--pds-spacing-button-height-s) - 2 * var(--pds-border-width-default)
	);
}

.pds-split-button--agentic .pds-button--m {
	--button-height: calc(
		var(--pds-spacing-button-height-m) - 2 * var(--pds-border-width-default)
	);
}

/* Animated (`isAnimated`): the gradient layer (the third) is twice the
   control's width and repeats, and slides by one tile so the loop is
   seamless. The fill layers stay put. Off for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
	.pds-split-button--agentic.pds-split-button--animated {
		animation: agentic-split-button-shimmer
			var(--pds-animation-duration-ai-shimmer) linear infinite;
		background-repeat: no-repeat, no-repeat, repeat-x;
		background-size:
			100% 100%,
			100% 100%,
			200% 100%;
	}
}

@keyframes agentic-split-button-shimmer {
	from {
		background-position:
			0 0,
			0 0,
			0 0;
	}

	to {
		background-position:
			0 0,
			0 0,
			-200% 0;
	}
}