Revolutionary YAML-driven UI component system designed for AI-controlled interfaces and agentic CMS platforms
AgenticUI is built on the revolutionary principle that AI agents should control UI components dynamically through declarative YAML configuration. Every component is AI-controllable by default, with personality-driven theming and agent-aware styling.
- Every component supports AI commands like
theme,layout,animate - Agent personalities drive dynamic styling
- Real-time UI adaptation based on agent preferences
@layer foundation, framework, agentic-layout, agentic-components, agentic-interactive, agentic-utilities;- Zero hardcoded CSS classes
- Declarative component definitions
- Agent-aware responsive behavior
- 451+ CSS custom properties
- Thread-safe variable management
- Personality-driven theme variations
Add to your Gemfile:
gem 'agentic_ui', path: './agentic_ui'<!-- Traditional Rails way -->
<div class="widget">
<div class="header">Welcome</div>
<div class="content">Content here</div>
</div>
<!-- Revolutionary AgenticUI way -->
<%= ux.widget do %>
<%= ux.header "Welcome" %>
<%= ux.content "Content here" %>
<% end %><!-- AI can dynamically control these components -->
<%= ux.card theme: "professional", animate: "fade-in" do %>
<%= ux.button style: "primary", personality: "technical" %>
<% end %>ux.container- Responsive containers with agent-aware spacingux.grid- CSS Grid with AI-controllable columns and gapsux.column- Grid columns with responsive behavior
ux.button- AI-themed buttons with personality stylingux.input- Form fields with agent-aware validationux.form- Enhanced forms with Stimulus integration
ux.widget- Revolutionary widget system with agent controlux.card- Smart cards with elevation and themingux.content- Typography with agent preferences
# In your controller
def show
agent_session = AgentSession.find(params[:id])
@agent_context = AgenticUi::AgentContext.from_agent_session(agent_session)
end<!-- In your view -->
<% set_agent_context(@agent_context) %>
<%= agentic_css_layers %>
<%= agentic_css_variables %>
<div <%= agent_context.data_attributes %>>
<%= ux.widget personality: "professional" do %>
<%= ux.header "Agent-Aware Header" %>
<% end %>
</div>- Professional: Clean, minimal, corporate styling
- Casual: Rounded corners, friendly animations
- Technical: Monospace fonts, precise spacing
AgenticUI implements a revolutionary 6-layer CSS cascade:
- CSS custom properties
- Agent-specific variables
- Theme foundation
- Base resets and normalizations
- Core component behaviors
- Grid systems and containers
- Responsive layout utilities
- Widget and card styling
- Content and typography
- Buttons and form controls
- Interactive element styling
- Agent-aware utilities
- AI control indicators
Components are defined in config/agentic_ui.yml:
ui:
widget:
tag: div
css_class: 'widget'
ai_controllable: true
ai_commands: ['theme', 'layout', 'animate', 'personality']
css_layer: 'agentic-components'
agent_aware: true
stimulus_controller: 'agentic-widget'
unified_theme_vars: ['--widget-background', '--widget-shadow']<%= ux.dropdown controller: "enhanced-dropdown" do %>
<%= ux.button "Toggle Dropdown" %>
<%= ux.menu do %>
<%= ux.link "Option 1", to: path_helper %>
<% end %>
<% end %><%= ux.form model: @user do |f| %>
<%= ux.input type: "text", placeholder: "Name" %>
<%= ux.button "Submit", type: "submit" %>
<% end %><!-- Automatic CSS variable integration -->
<%= ux.card do %>
<% # Uses --card-background, --card-shadow, etc. %>
<%= ux.content "Themed content" %>
<% end %>AgenticUi.configure do |config|
config.register_component :custom_widget,
tag: 'section',
css_class: 'custom-widget',
ai_controllable: true,
ai_commands: ['theme', 'layout'],
css_layer: 'agentic-components'
end# Thread-safe context switching
AgenticUi::AgentContext.with_context(professional_context) do
# All UI components use professional styling
render 'dashboard'
endAgenticUI automatically generates CSS variables:
:root {
--agent-primary: #2563eb;
--agent-surface: #ffffff;
--agent-text: #1f2937;
--agent-personality: professional;
--agentic-border-radius: 4px;
--agentic-shadow-intensity: 0.08;
}.widget {
background: var(--agentic-widget-background, var(--agent-surface));
border-radius: var(--agentic-widget-radius, var(--agent-border-radius));
box-shadow: var(--agentic-widget-shadow, var(--agent-shadow));
}RSpec.describe "AgenticUI Components" do
let(:agent_context) { AgenticUi::AgentContext.new(personality: 'technical') }
it "renders AI-controllable components" do
AgenticUi::AgentContext.with_context(agent_context) do
component = AgenticUi::WrapperComponent.new(:widget, theme: 'dark')
expect(component.ai_controllable?).to be true
end
end
endimport { test, expect } from '@playwright/test';
test('AI-controllable components', async ({ page }) => {
await page.goto('/dashboard');
// Check for AI control indicators
const widget = page.locator('[data-ai-controllable="true"]');
await expect(widget).toHaveAttribute('data-ai-commands', 'theme,layout,animate');
});- XSS Protection: All user inputs are sanitized
- CSS Injection Prevention: Validates CSS property names
- Agent Context Isolation: Thread-safe context management
- CSS Layers: Optimal cascade performance
- Variable Caching: Efficient CSS custom property management
- Lazy Loading: Components load only when needed
AgenticUi::Display- Main component factoryAgenticUi::WrapperComponent- Component wrapper with Rails integrationAgenticUi::AgentContext- Agent-aware context managementAgenticUi::CssLayers- 6-layer CSS architectureAgenticUi::Configuration- YAML-driven configuration
ux- Access to component factoryset_agent_context(context)- Set current agent contextagentic_css_layers- Render CSS layersagentic_css_variables- Render agent variables
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Follow TDD principles - tests first!
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
The gem is available as open source under the terms of the MIT License.
- Built for the revolutionary StoryPRO Platform
- Inspired by the future of Agentic CMS architecture
- Powered by Rails 8.0.2 and modern CSS
AgenticUI - Where AI meets UI π€β¨