Siticone Logo
Siticone UI
DOCS
v2025.12.15
Docs Button Textbox

Siticone Button Text Box

The SiticoneButtonTextbox is a versatile composite control that combines a text input field with an actionable button and an optional icon. It is ideal for creating search bars, password inputs with "show/hide" toggles, file pickers, or chat input fields, all within a unified, stylish component.

Integrated Button

The control features a built-in button on the right side. This button supports images, custom colors, hover effects, and ripple animations.

Property Type Description & Usage Example
ButtonImageIdle Image btnTxt.ButtonImageIdle = Resources.search; The default icon displayed on the button.
ButtonImageHover Image btnTxt.ButtonImageHover = Resources.search_hover; Icon shown when the mouse hovers over the button.
ButtonColor Color Background color of the button in its idle state.
ButtonHoverColor Color Background color when the button is hovered.
ButtonSize int Width and height of the square button area (Default: 30).

Input Icon

You can place an icon on the left side of the text area to provide context (e.g., a user icon for a username field).

Property Type Description
IdleImage Image The primary icon displayed on the left.
ImageLeftSize int Size of the left icon (Default: 20).
TextLeftMargin int Spacing between the left icon and the text input.

Validation & Security

Like other Siticone text controls, this includes built-in validation logic.

Property Type Description
InputType Enum String, Digit, Email, or Password.
ValidationEnabled bool Enables or disables automatic validation checks.
Password Criteria bool Properties like RequireUppercase, RequireDigits, etc., used when InputType is Password.

Events

Handle user interactions with the button, text changes, and keyboard inputs.

ButtonClick Event
// Fired when the integrated button is clicked.
searchBox.ButtonClick += (s, e) => 
{
                // Access the current text content directly from arguments
                PerformSearch(e.TextContent);
                if (e.IsProgrammatic)
    {
                Console.WriteLine("Search triggered by code.");
    }
};
TextContentChangedEnhanced Event
// Fired when text changes, providing old and new values.
searchBox.ButtonTextboxTextChangedEnhanced += (s, e) => 
{
                Console.WriteLine($"Query changed: {e.OldText} -> {e.NewText}");
};
EnterKeyPressed Event
// Fired when the Enter key is pressed.
Automatically suppresses the "ding" sound.
// Provides a full snapshot of the control state (Text, Validation, InputType).
searchBox.EnterKeyPressed += (s, e) => 
{
                if (!e.IsValid)
    {
                MessageBox.Show($"Validation Error: {e.ValidationError}");
                return;
    }
                Console.WriteLine($"User submitted: {e.TextContent}");
};

Designer Support

The control includes a comprehensive Smart Tag menu in Visual Studio for rapid configuration.

Category Features
Quick Setups One-click configuration for Search Bar, Password Field, Email Field, etc.
Theme Presets Apply themes like Light, Dark, Corporate Blue, etc.
Appearance Shortcuts for Corner Radius, Border Width, and Placeholder Text.

Usage Examples

Example 1: Search Bar

Create a standard search input with a magnifying glass button.

C# - Search Bar Setup
private void SetupSearchBar()
{
                // Configure basic properties
    searchBox.PlaceholderText = "Search...";
    searchBox.MakeRadial = true; // Pill shape
    
                // Set Button Icon (assuming Resources exist)
    searchBox.ButtonImageIdle = Properties.Resources.search_icon;
    searchBox.ButtonColor = Color.DodgerBlue;
    
                // Handle Search Action
    searchBox.ButtonClick += (s, e) => 
    {
                ExecuteSearch(e.TextContent);
    };
    
                // Allow "Enter" key to trigger search button
    searchBox.KeyDown += (s, e) => 
    {
                if (e.KeyCode == Keys.Enter) 
        {
            searchBox.PerformClick();
            e.SuppressKeyPress = true;
        }
    };
}

Example 2: Password Field with Toggle

A password input where the button toggles visibility.

C# - Password Toggle
private void SetupPasswordInput()
{
    pwdBox.InputType = ButtonTextboxInputType.Password;
    pwdBox.PlaceholderText = "Password";
    
                // Set Icons for Show/Hide states
                Image eyeOpen = Properties.Resources.eye_open;
                Image eyeClosed = Properties.Resources.eye_closed;
    
    pwdBox.ButtonImageIdle = eyeClosed;
    pwdBox.ButtonColor = Color.Transparent;
                // Invisible button background
    
    pwdBox.ButtonClick += (s, e) => 
    {
                bool isPassword = pwdBox.UseSystemPasswordChar;
        pwdBox.UseSystemPasswordChar = !isPassword;
        pwdBox.ButtonImageIdle = !isPassword ? eyeClosed : eyeOpen;
    };
}

Example 3: File Picker

An input field for a file path with a "Browse" button.

C# - File Picker
private void SetupFilePicker()
{
    fileBox.PlaceholderText = "Select a file...";
    fileBox.IsReadOnly = true; // User must use button
    
                // Use folder icon
    fileBox.ButtonImageIdle = Properties.Resources.folder_open;
    fileBox.ButtonClick += (s, e) => 
    {
                using (var dialog = new OpenFileDialog())
        {
                if (dialog.ShowDialog() == DialogResult.OK)
            {
                fileBox.TextContent = dialog.FileName;
            }
        }
    };
}

Example 4: Material Design Chat Input

A sleek, bottom-border-only input for chat applications.

C# - Chat Input
private void SetupChatInput()
{
    chatBox.TextBoxStyle = ButtonTextboxStyle.Material;
    chatBox.PlaceholderText = "Type a message...";
    
                // Send button style
    chatBox.ButtonImageIdle = Properties.Resources.send_plane;
    chatBox.ButtonColor = Color.Teal;
    chatBox.ButtonHoverColor = Color.LightSeaGreen;
    chatBox.ButtonCornerRadius = 15;
                // Round button
    
    chatBox.ButtonClick += (s, e) => 
    {
                if (!string.IsNullOrWhiteSpace(e.TextContent))
        {
                SendMessage(e.TextContent);
                chatBox.TextContent = string.Empty; // Clear after sending
        }
    };
}

Example 5: Handling Enter Key Submissions

This example demonstrates how to capture the Enter key, validate the data using the comprehensive event arguments, and perform a submission.

C# - Enter Key Handler
private void SetupEnterKeyHandler()
{
    submitBox.PlaceholderText = "Type and press Enter...";
    submitBox.InputType = ButtonTextboxInputType.Email;
    submitBox.ValidationEnabled = true;

    submitBox.EnterKeyPressed += (s, e) =>
    {
                // 1. Check if the input is valid based on InputType (Email)
                if (!e.IsValid)
        {
                MessageBox.Show($"Cannot submit: {e.ValidationError}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
        }

                // 2. Process the valid data
                ProcessEmail(e.TextContent);
                // Note: The 'ding' sound is automatically suppressed by the control.
    };
}